Class StringType

All Implemented Interfaces:
Serializable, SimpleType, Type

public final class StringType extends PrimitiveType
The string type.
See Also:
  • Field Details

  • Method Details

    • validate

      public boolean validate(Object object)
      Description copied from interface: Type
      Tests whether the given object is of this type.
      Specified by:
      validate in interface Type
      Specified by:
      validate in class PrimitiveType
      Parameters:
      object - the object to test
      Returns:
      true if the given object if of this type, false otherwise
    • convert

      public Object convert(Object value)
      Description copied from interface: Type
      Converts the given value to an object compatible with the associated type.
      Parameters:
      value - the value to convert
      Returns:
      the converted value
    • decode

      public Object decode(String str)
      Description copied from interface: Type
      Decodes the string representation into an object of this type.

      Returns null if the string can not be decoded.

      Specified by:
      decode in interface Type
      Overrides:
      decode in class AbstractType
      Parameters:
      str - the string to decode
      Returns:
      the converted object that can be use as a value for an object of this type or null if the given object cannot be converted
    • encode

      public String encode(Object object)
      Description copied from interface: Type
      Encodes the given object that is assumed to be of this type into a string representation.

      Null is returned if the object cannot be converted.

      Specified by:
      encode in interface Type
      Overrides:
      encode in class AbstractType
      Parameters:
      object - the object to convert
      Returns:
      the string representation of the given object or null if object cannot be converted
    • newInstance

      public Object newInstance()
      Description copied from interface: Type
      Creates a new instance according to this type and filled with default values.
      Specified by:
      newInstance in interface Type
      Overrides:
      newInstance in class AbstractType
    • readResolve

      protected Object readResolve()
    • support

      public boolean support(Class<? extends Constraint> constraint)
      Specified by:
      support in class PrimitiveType
      Returns:
      true if this primitive types supports this constraints, false otherwise.