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)
    Deprecated.
    For removal since 1.1.0, create new options within an OptionSchema instead
    @Nullable V
    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)
    Deprecated.
    For removal since 1.1.0, create new options within an OptionSchema instead
    id()
    Get the option id.
    default Class<V>
    Deprecated.
    for removal since 1.1.0, use valueType() instead
    Get information about the option's value type.
  • Method Details

    • booleanOption

      @Deprecated static Option<Boolean> booleanOption(String id, boolean defaultValue)
      Deprecated.
      For removal since 1.1.0, create new options within an OptionSchema instead
      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

      @Deprecated static <E extends Enum<E>> Option<E> enumOption(String id, Class<E> enumClazz, E defaultValue)
      Deprecated.
      For removal since 1.1.0, create new options within an OptionSchema instead
      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

      String id()
      Get the option id.

      This must be unique among options.

      Returns:
      the flag id
      Since:
      1.0.0
    • type

      @Deprecated default Class<V> type()
      Deprecated.
      for removal since 1.1.0, use valueType() instead
      Get the type of the option value.
      Returns:
      the value type
      Since:
      1.0.0
    • valueType

      ValueType<V> valueType()
      Get information about the option's value type.
      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