Class PropertyTypeString

java.lang.Object
com.pnfsoftware.jeb.core.properties.impl.PropertyTypeString
All Implemented Interfaces:
IPropertyType, IPropertyTypeString

public final class PropertyTypeString extends Object implements IPropertyTypeString
String property type with optional length constraints.
  • Method Details

    • create

      public static PropertyTypeString create(int min, int max, String def)
      Create a string property type.
      Parameters:
      min - minimum allowed length
      max - maximum allowed length
      def - default value
      Returns:
      a cached property type instance
    • create

      public static PropertyTypeString create(String s)
      Create a string property type without explicit length constraints.
      Parameters:
      s - default value
      Returns:
      a cached property type instance
    • create

      public static PropertyTypeString create()
      Define a string property that defaults to the empty string.
      Returns:
      the property type
    • getName

      public String getName()
      Description copied from interface: IPropertyType
      Get the type name.
      Specified by:
      getName in interface IPropertyType
      Returns:
      the human-readable type name
    • getMinLength

      public int getMinLength()
      Description copied from interface: IPropertyTypeString
      Get the minimum allowed string length.
      Specified by:
      getMinLength in interface IPropertyTypeString
      Returns:
      the minimum length
    • getMaxLength

      public int getMaxLength()
      Description copied from interface: IPropertyTypeString
      Get the maximum allowed string length.
      Specified by:
      getMaxLength in interface IPropertyTypeString
      Returns:
      the maximum length
    • getDefault

      public String getDefault()
      Description copied from interface: IPropertyType
      Get the default value.
      Specified by:
      getDefault in interface IPropertyType
      Specified by:
      getDefault in interface IPropertyTypeString
      Returns:
      the default value, cannot be null
    • validate

      public boolean validate(Object value)
      Description copied from interface: IPropertyType
      Validate a property value.
      Specified by:
      validate in interface IPropertyType
      Parameters:
      value - the property value
      Returns:
      true on success
    • afterRead

      public Object afterRead(IPropertyDefinition def, Object value)
      Description copied from interface: IPropertyType
      Post-processing to be done after reading a value. This method should only be called after a successful call to IPropertyType.validate(Object).
      Specified by:
      afterRead in interface IPropertyType
      Parameters:
      def - property definition associated with the value
      value - must not be null
      Returns:
      the converted value to expose to clients
    • beforeWrite

      public Object beforeWrite(IPropertyDefinition def, Object value)
      Description copied from interface: IPropertyType
      Pre-processing to be done before storing a value.
      Specified by:
      beforeWrite in interface IPropertyType
      Parameters:
      def - property definition associated with the value
      value - value to be stored
      Returns:
      the converted value to persist
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object