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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object convert​(java.lang.String name, java.lang.Class<?> type, java.lang.String value)
      Convert a string value into an appropriately typed value
      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
    • Method Detail

      • convert

        java.lang.Object convert​(java.lang.String name,
                                 java.lang.Class<?> type,
                                 java.lang.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:
        java.lang.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