Interface Pointers

All Superinterfaces:
Buildable<Pointers.Builder>

public sealed interface Pointers extends Buildable<Pointers.Builder>
A collection of pointers.
Since:
4.8.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A builder of pointers.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets a new pointers builder.
    static Pointers
    Gets an empty pointers collection.
    <T> Optional<T>
    get(Pointer<T> pointer)
    Gets the value of pointer.
    default <T> @Nullable T
    getOrDefault(Pointer<T> pointer, @Nullable T defaultValue)
    Gets the value of pointer.
    default <T> @UnknownNullability T
    getOrDefaultFrom(Pointer<T> pointer, Supplier<? extends T> defaultValue)
    Gets the value of pointer.
    <T> boolean
    supports(Pointer<T> pointer)
    Checks if a given pointer is supported.

    Methods inherited from interface Buildable

    toBuilder
  • Method Details

    • empty

      @Contract(pure=true) static Pointers empty()
      Gets an empty pointers collection.
      Returns:
      the pointers
      Since:
      4.8.0
    • builder

      @Contract(pure=true) static Pointers.Builder builder()
      Gets a new pointers builder.
      Returns:
      the builder
      Since:
      4.8.0
      See Also:
    • get

      <T> Optional<T> get(Pointer<T> pointer)
      Gets the value of pointer.
      Type Parameters:
      T - the type
      Parameters:
      pointer - the pointer
      Returns:
      the value
      Since:
      4.8.0
    • getOrDefault

      @Contract("_, null -> _; _, !null -> !null") default <T> @Nullable T getOrDefault(Pointer<T> pointer, @Nullable T defaultValue)
      Gets the value of pointer.

      If a value for pointer is unable to be provided, defaultValue will be returned.

      Type Parameters:
      T - the type
      Parameters:
      pointer - the pointer
      defaultValue - the default value
      Returns:
      the value
      Since:
      4.8.0
    • getOrDefaultFrom

      default <T> @UnknownNullability T getOrDefaultFrom(Pointer<T> pointer, Supplier<? extends T> defaultValue)
      Gets the value of pointer.

      If a value for pointer is unable to be provided, the value supplied by defaultValue will be returned.

      Type Parameters:
      T - the type
      Parameters:
      pointer - the pointer
      defaultValue - the default value supplier
      Returns:
      the value
      Since:
      4.8.0
    • supports

      <T> boolean supports(Pointer<T> pointer)
      Checks if a given pointer is supported.

      This will return true when a mapping for the provided pointer exists, even if the value for the pointer is null.

      Type Parameters:
      T - the type
      Parameters:
      pointer - the pointer
      Returns:
      if the pointer is supported
      Since:
      4.8.0