Package org.fastnate.generator.converter
Class StringConverter
java.lang.Object
org.fastnate.generator.converter.StringConverter
- All Implemented Interfaces:
ValueConverter<String>
Converts a string property of an
EntityClass.- Author:
- Tobias Liefke
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate static final intprivate final intprivate final intprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of a StringConverter that accepts strings of arbitrary length.StringConverter(jakarta.persistence.Column column, boolean nullable) Creates a new instance of a StringConverter for the given column definition.StringConverter(AttributeAccessor attribute, boolean mapKey) Creates a new instance of a StringConverter for the given attribute. -
Method Summary
Modifier and TypeMethodDescriptiongetExpression(String value, GeneratorContext context) Builds the expression for writing the default value into an SQL clause.
-
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
-
-
Constructor Details
-
StringConverter
public StringConverter()Creates a new instance of a StringConverter that accepts strings of arbitrary length. -
StringConverter
Creates a new instance of a StringConverter for the given attribute.- Parameters:
attribute- the attribute to convertmapKey- 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 isnullnullable- indicates that the column may benullaccording to other settings (may be overridden by the column definition)
-
-
Method Details
-
getExpression
Description copied from interface:ValueConverterBuilds the expression for writing the default value into an SQL clause.- Specified by:
getExpressionin interfaceValueConverter<String>- Parameters:
value- the default value, as given in anDefaultValueexpressioncontext- the current context (contains the database dialect).- Returns:
- the expression (that is including surrounding ' for string literals)
-