Class OptionType<T>

  • Type Parameters:
    T - the target type
    Direct Known Subclasses:
    ExceptionOptionType

    public abstract class OptionType<T>
    extends Object
    This class is used to define the type of argument
    • Field Detail

      • DEFAULT_OPTION_TYPE

        public static final OptionType<String> DEFAULT_OPTION_TYPE
        Accept all values
    • Constructor Detail

      • OptionType

        public OptionType()
    • Method Detail

      • parse

        public abstract T parse​(String v)
        Parse the value to the target type. Note: called only when accept(String) return true.
        Parameters:
        v - the value
        Returns:
        the target type
      • accept

        public abstract boolean accept​(String v)
        Indicate whether this type can accept the value.
        Parameters:
        v - the value
        Returns:
        true if can accept, false otherwise