Class StringProperty

All Implemented Interfaces:
Serializable, Cloneable, Iterable<Property>, Property

public class StringProperty extends ScalarProperty
Author:
Bogdan Stefanescu
See Also:
  • Constructor Details

    • StringProperty

      public StringProperty(Property parent, Field field, int flags)
  • Method Details

    • isNormalized

      public boolean isNormalized(Object value)
      Description copied from interface: Property
      Checks if the given value is a normalized one. This means the value has a type that is normalized.

      Null values are considered as normalized.

      Specified by:
      isNormalized in interface Property
      Overrides:
      isNormalized in class AbstractProperty
      Parameters:
      value - the value to check
      Returns:
      true if the value is normalized false otherwise
    • normalize

      public Serializable normalize(Object value) throws PropertyConversionException
      Description copied from interface: Property
      Normalizes the given value as dictated by the property type.

      Normalized values are the ones that are used for transportation over the net and that are given to the storage implementation to be stored in the repository

      Normalized values must be Serializable

      If the given value is already normalized it will be returned back.

      Specified by:
      normalize in interface Property
      Overrides:
      normalize in class AbstractProperty
      Parameters:
      value - the value to normalize according to the property type
      Returns:
      the normalized value
      Throws:
      PropertyConversionException
    • convertTo

      public <T> T convertTo(Serializable value, Class<T> toType) throws PropertyConversionException
      Description copied from interface: Property
      Converts the given normalized value to the given type.

      If the value has already the given type it will be returned back.

      Specified by:
      convertTo in interface Property
      Overrides:
      convertTo in class AbstractProperty
      Parameters:
      value - the normalized value to convert
      toType - the conversion type
      Returns:
      the converted value, which may be null
      Throws:
      PropertyConversionException - if the conversion cannot be made because of type incompatibilities
    • newInstance

      public Object newInstance()
      Description copied from interface: Property
      Creates a new and empty instance of a normalized value.

      Empty is used in the sense of a value that has not been initialized or can be considered as an empty value. For example for the String type the empty value will be the empty string ""

      Specified by:
      newInstance in interface Property
      Overrides:
      newInstance in class AbstractProperty
      Returns:
      the empty instance the empty instance, or null for some implementations