Package net.kyori.adventure.pointer
Interface Pointers
- All Superinterfaces:
Buildable<Pointers,Pointers.Builder>
public interface Pointers extends Buildable<Pointers,Pointers.Builder>
A collection of
pointers.- Since:
- 4.8.0
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfacePointers.BuilderA builder of pointers. -
Method Summary
Modifier and Type Method Description static @NotNull Pointers.Builderbuilder()Gets a new pointers builder.static @NotNull Pointersempty()Gets an empty pointers collection.<T> @NotNull Optional<T>get(@NotNull Pointer<T> pointer)Gets the value ofpointer.default <T> TgetOrDefault(@NotNull Pointer<T> pointer, T defaultValue)Gets the value ofpointer.default <T> @UnknownNullability TgetOrDefaultFrom(@NotNull Pointer<T> pointer, @NotNull Supplier<? extends T> defaultValue)Gets the value ofpointer.<T> booleansupports(@NotNull Pointer<T> pointer)Checks if a given pointer is supported.
-
Method Details
-
empty
Gets an empty pointers collection.- Returns:
- the pointers
- Since:
- 4.8.0
-
builder
Gets a new pointers builder.- Returns:
- the builder
- Since:
- 4.8.0
- See Also:
Pointers.Builder
-
get
Gets the value ofpointer.- Type Parameters:
T- the type- Parameters:
pointer- the pointer- Returns:
- the value
- Since:
- 4.8.0
-
getOrDefault
@Contract("_, !null -> !null; _, null -> null") @Nullable default <T> T getOrDefault(@NotNull @NotNull Pointer<T> pointer, @Nullable T defaultValue)Gets the value ofpointer.If a value for
pointeris unable to be provided,defaultValuewill be returned.- Type Parameters:
T- the type- Parameters:
pointer- the pointerdefaultValue- the default value- Returns:
- the value
- Since:
- 4.8.0
-
getOrDefaultFrom
default <T> @UnknownNullability T getOrDefaultFrom(@NotNull @NotNull Pointer<T> pointer, @NotNull @NotNull Supplier<? extends T> defaultValue)Gets the value ofpointer.If a value for
pointeris unable to be provided, the value supplied bydefaultValuewill be returned.- Type Parameters:
T- the type- Parameters:
pointer- the pointerdefaultValue- the default value supplier- Returns:
- the value
- Since:
- 4.8.0
-
supports
Checks if a given pointer is supported.This will return
truewhen a mapping for the provided pointer exists, even if the value for the pointer isnull.- Type Parameters:
T- the type- Parameters:
pointer- the pointer- Returns:
- if the pointer is supported
- Since:
- 4.8.0
-