Enum BaseTypeConverter

    • Method Detail

      • values

        public static BaseTypeConverter[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (BaseTypeConverter c : BaseTypeConverter.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static BaseTypeConverter valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • convert

        public Object convert​(String optionName,
                              String valueStr,
                              TypeToken<?> pType,
                              Annotation pSecondaryOption,
                              Path pSource,
                              LogManager logger)
                       throws InvalidConfigurationException
        Description copied from interface: TypeConverter
        Convert a String given by the user to an instance of a given type.

        Although the signature of this method does not enforce it, the class of the returned value needs to be assignable to "type" as defined by TypeToken.isSupertypeOf(java.lang.reflect.Type).

        Before this method is called, the caller ensures that all requirements for the option defined with the Option annotation are met.

        Specified by:
        convert in interface TypeConverter
        Parameters:
        optionName - The name of the option (should only be used for nice error messages).
        valueStr - The string to parse.
        pType - The target type.
        pSecondaryOption - An optional second annotation for the option (this is one of the annotations marked with OptionDetailAnnotation).
        pSource - The file where the configuration option was read from. May contain a dummy value or null if the option was given somehow else.
        logger - A logger for warnings etc.
        Returns:
        An instance of the target type produced from the string representation-
        Throws:
        InvalidConfigurationException - If the user specified an invalid value.