Interface TypeWrapper

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractSimpleTypeWrapper, BooleanTypeWrapper, ColorTypeWrapper, EnumTypeWrapper, NumberTypeWrapper, StringTypeWrapper, TLIListTypeWrapper

public interface TypeWrapper extends Serializable
Encapsulates information about a parameter's value type and how values should be converted between strings and the appropriate object instances.

This allows elimination of an additional "evil" if-elseif...else" pattern.

Version:
$Revision: 03dc0884e86f $
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Error message for failed to convert 1/2.
    static final String
    Error message for failed to convert 2/2.
  • Method Summary

    Modifier and Type
    Method
    Description
    Attempts to convert a parameter value expressed as string into an instance of the appropriate (for this parameter) type.
     
    Attempts to convert a parameter value expressed as an object of the appropriate (for this parameter) type into a string representation.
    boolean
    Checks if the object is of a valid type for this type info.
  • Field Details

  • Method Details

    • getValueType

      Class<?> getValueType()
      Returns:
      the class instance being wrapped
    • valid

      boolean valid(Object o)
      Checks if the object is of a valid type for this type info.
      Parameters:
      o - the object to check
      Returns:
      true if the parameter can be set.
    • fromString

      Object fromString(String value)
      Attempts to convert a parameter value expressed as string into an instance of the appropriate (for this parameter) type.
      Parameters:
      value - parameter value as string
      Returns:
      parameter value as an instance of the proper type
    • toString

      String toString(Object value)
      Attempts to convert a parameter value expressed as an object of the appropriate (for this parameter) type into a string representation.
      Parameters:
      value - parameter value as object
      Returns:
      parameter value as string