Interface ValueType<T>

Type Parameters:
T - the actual type

public interface ValueType<T>
A possible type for an option value.
Since:
1.1.0
  • Method Details

    • stringType

      static ValueType<String> stringType()
      Provide a value type for string values.
      Returns:
      a value type for string values
      Since:
      1.1.0
    • booleanType

      static ValueType<Boolean> booleanType()
      Provide a value type for boolean values.
      Returns:
      a value type for boolean values
      Since:
      1.1.0
    • integerType

      static ValueType<Integer> integerType()
      Provide a value type for integer values.
      Returns:
      a value type for integer values
      Since:
      1.1.0
    • doubleType

      static ValueType<Double> doubleType()
      Provide a value type for double values.
      Returns:
      a value type for double values
      Since:
      1.1.0
    • enumType

      static <E extends Enum<E>> ValueType<E> enumType(Class<E> enumClazz)
      Provide a value type for enum values.
      Type Parameters:
      E - the enum type
      Parameters:
      enumClazz - the enum class
      Returns:
      a value type for enum values
      Since:
      1.1.0
    • type

      Class<T> type()
      The type representing the value.
      Returns:
      the object type of the value
      Since:
      1.1.0
    • parse

      T parse(String plainValue) throws IllegalArgumentException
      Extract a value of this type from a plain string.
      Parameters:
      plainValue - a plain-text value
      Returns:
      the value coerced to the correct type
      Throws:
      IllegalArgumentException - if the value is not of an appropriate type
      Since:
      1.1.0