Interface Option<V>

Type Parameters:
V - the value type

@NonExtendable public interface Option<V>
A representation of a configurable option.

Keys must be unique among all feature flag instances.

Since:
1.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static Option<Boolean>
    booleanOption(String id, boolean defaultValue)
    Create an option with a boolean value type.
    Get a default value for the option, if any is present.
    static <E extends Enum<E>>
    Option<E>
    enumOption(String id, Class<E> enumClazz, E defaultValue)
    Create an option with an enum value type.
    @NotNull String
    id()
    Get the option id.
    @NotNull Class<V>
    Get the type of the option value.
  • Method Details

    • booleanOption

      static Option<Boolean> booleanOption(String id, boolean defaultValue)
      Create an option with a boolean value type.

      Flag keys must not be reused between flag instances.

      Parameters:
      id - the flag id
      defaultValue - the default value
      Returns:
      the flag instance
      Since:
      1.0.0
    • enumOption

      static <E extends Enum<E>> Option<E> enumOption(String id, Class<E> enumClazz, E defaultValue)
      Create an option with an enum value type.

      Flag keys must not be reused between flag instances.

      Type Parameters:
      E - the enum type
      Parameters:
      id - the flag id
      enumClazz - the value type
      defaultValue - the default value
      Returns:
      the flag instance
      Since:
      1.0.0
    • id

      @NotNull @NotNull String id()
      Get the option id.

      This must be unique among options.

      Returns:
      the flag id
      Since:
      1.0.0
    • type

      @NotNull @NotNull Class<V> type()
      Get the type of the option value.
      Returns:
      the value type
      Since:
      1.0.0
    • defaultValue

      @Nullable V defaultValue()
      Get a default value for the option, if any is present.
      Returns:
      the default value
      Since:
      1.0.0