Interface TypeConverter

All Known Implementing Classes:
DefaultTypeConverter, ExtendedTypeConverter

public interface TypeConverter
Interface for type converters

Type converters are used to convert the string values provided as option/argument values into appropriately typed values that can be assigned to the relevant option/arguments

  • Method Summary

    Modifier and Type
    Method
    Description
    convert(String name, Class<?> type, String value)
    Convert a string value into an appropriately typed value
    void
    Sets the numeric type converter to use, if null then default behaviour of the type converter instance (whatever that might be) will be used
  • Method Details

    • convert

      Object convert(String name, Class<?> type, String value)
      Convert a string value into an appropriately typed value
      Parameters:
      name - Option Name
      type - Target Type
      value - String Value
      Returns:
      Typed value
      Throws:
      NullPointerException - Should be thrown if any of the provided arguments is null
      ParseOptionConversionException - Should be thrown if the type converter cannot convert the value
    • setNumericConverter

      void setNumericConverter(NumericTypeConverter converter)
      Sets the numeric type converter to use, if null then default behaviour of the type converter instance (whatever that might be) will be used
      Parameters:
      converter - Numeric type converter