Class StringConverter

java.lang.Object
org.fastnate.generator.converter.StringConverter
All Implemented Interfaces:
ValueConverter<String>

public class StringConverter extends Object implements ValueConverter<String>
Converts a string property of an EntityClass.
Author:
Tobias Liefke
  • Field Details

    • DEFAULT_COLUMN_LENGTH

      private static final int DEFAULT_COLUMN_LENGTH
      See Also:
    • maxSize

      private final int maxSize
    • minSize

      private final int minSize
    • nullable

      private boolean nullable
    • attributeName

      private final String attributeName
  • Constructor Details

    • StringConverter

      public StringConverter()
      Creates a new instance of a StringConverter that accepts strings of arbitrary length.
    • StringConverter

      public StringConverter(AttributeAccessor attribute, boolean mapKey)
      Creates a new instance of a StringConverter for the given attribute.
      Parameters:
      attribute - the attribute to convert
      mapKey - indicates that the converter is used for the key of a map property
    • StringConverter

      public StringConverter(jakarta.persistence.Column column, boolean nullable)
      Creates a new instance of a StringConverter for the given column definition.
      Parameters:
      column - contains the optional definition, the converter uses the defaults if the column is null
      nullable - indicates that the column may be null according to other settings (may be overridden by the column definition)
  • Method Details

    • getExpression

      public ColumnExpression getExpression(String value, GeneratorContext context)
      Description copied from interface: ValueConverter
      Builds the expression for writing the default value into an SQL clause.
      Specified by:
      getExpression in interface ValueConverter<String>
      Parameters:
      value - the default value, as given in an DefaultValue expression
      context - the current context (contains the database dialect).
      Returns:
      the expression (that is including surrounding ' for string literals)