Interface PropertyConverter

All Known Implementing Classes:
Converter, DateConverter, DefaultConverter, NumberConverter, TimeConverter

public interface PropertyConverter
Converts strings to objects and back.
Version:
$Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/util/convert/PropertyConverter.java#1 $
Author:
Harald Kuhr, last modified by $Author: haku $
  • Method Summary

    Modifier and Type
    Method
    Description
    toObject(String pString, Class pType, String pFormat)
    Converts the string to an object, using the given format for parsing.
    toString(Object pObject, String pFormat)
    Converts the object to a string, using the given format
  • Method Details

    • toObject

      Object toObject(String pString, Class pType, String pFormat) throws ConversionException
      Converts the string to an object, using the given format for parsing.
      Parameters:
      pString - the string to convert
      pType - the type to convert to. PropertyConverter implementations may choose to ignore this parameter.
      pFormat - the format used for parsing. PropertyConverter implementations may choose to ignore this parameter. Also, implementations that require a parser format, should provide a default format, and allow null as the format argument.
      Returns:
      the object created from the given string.
      Throws:
      ConversionException - if the string could not be converted to the specified type and format.
    • toString

      String toString(Object pObject, String pFormat) throws ConversionException
      Converts the object to a string, using the given format
      Parameters:
      pObject - the object to convert
      pFormat - the format used for parsing. PropertyConverter implementations may choose to ignore this parameter. Also, implementations that require a parser format, should provide a default format, and allow null as the format argument.
      Returns:
      the string representation of the object, on the correct format.
      Throws:
      ConversionException - if the string could not be converted to the specified type and format.