Interface Converter<T>

All Known Implementing Classes:
AffineTransformConverter, ArrayConverter, BooleanConverter, BooleanExpressionConverter, ByteConverter, CharacterConverter, ClassConverter, ColorConverter, CssColorConverter, DateFormatConverter, DoubleConverter, EnumConverter, FileConverter, FloatConverter, FontConverter, GeneralExpressionConverter, IntegerConverter, IntervalConverter, JavaTypeConverter, JtsGeometryConverter, LongConverter, NumberConverter, NumberFormatConverter, PathConverter, PatternConverter, QuantizationOp.MapIntegerRangeConverter, RectangleConverter, ShortConverter, StringConverter, UrlConverter

public interface Converter<T>
A Converter provides a strategy to convert a value of a certain type from plain text to a Java object and vice versa.
Since:
0.6
  • Method Summary

    Modifier and Type
    Method
    Description
    format(T value)
    Converts a value of the type returned by getValueType() to its plain text representation.
    Class<? extends T>
    Gets the value type.
    parse(String text)
    Converts a value from its plain text representation to a Java object instance of the type returned by getValueType().
  • Method Details

    • getValueType

      Class<? extends T> getValueType()
      Gets the value type.
      Returns:
      The value type.
    • parse

      T parse(String text) throws ConversionException
      Converts a value from its plain text representation to a Java object instance of the type returned by getValueType().
      Parameters:
      text - The textual representation of the value.
      Returns:
      The converted value.
      Throws:
      ConversionException - If the conversion fails.
    • format

      String format(T value)
      Converts a value of the type returned by getValueType() to its plain text representation.
      Parameters:
      value - The value to be converted to text.
      Returns:
      The textual representation of the value.