Package com.exedio.cope
Class StringField
- java.lang.Object
-
- com.exedio.cope.Feature
-
- com.exedio.cope.Field<E>
-
- com.exedio.cope.FunctionField<String>
-
- com.exedio.cope.StringField
-
- All Implemented Interfaces:
Copyable
,Function<String>
,Selectable<String>
,Settable<String>
,StringFunction
,Serializable
public final class StringField extends FunctionField<String> implements StringFunction
Represents a field within atype
, that enables instances of that type to store a string.- Author:
- Ralf Wiebicke
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_LENGTH
Deprecated.UseDEFAULT_MAXIMUM_LENGTH
insteadstatic int
DEFAULT_MAXIMUM_LENGTH
static int
DEFAULT_MINIMUM_LENGTH
static StringFieldMinimumLength
EMPTY
Deprecated.Check carefully, if empty string should really be allowed.
-
Constructor Summary
Constructors Constructor Description StringField()
Creates a new mandatoryStringField
.StringField(StringFieldMinimumLength minimumLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description StringField
characterSet(CharacterSet characterSet)
Deprecated.UsecharSet(CharSet)
insteadStringField
charSet(CharSet charSet)
StringField
copy()
StringField
copyFrom(ItemField<?> copyFrom)
StringField
defaultTo(String defaultConstant)
CharacterSet
getCharacterSet()
Deprecated.UsegetCharSet()
insteadCharSet
getCharSet()
Set<Class<? extends Throwable>>
getInitialExceptions()
Returns the exceptions possibly thrown, when setting a value for this settable.int
getMaximumLength()
int
getMinimumLength()
com.exedio.cope.SelectType<String>
getValueType()
Condition
hashDoesNotMatch(String algorithm, DataField data)
Deprecated.UsehashDoesNotMatchIfSupported(String, DataField)
instead.Condition
hashDoesNotMatchIfSupported(String algorithm, DataField data)
The result may cause anUnsupportedQueryException
when used, if the field is stored in avault
, or thealgorithm
is not supported by the database.Condition
hashMatches(String algorithm, DataField data)
Deprecated.UsehashMatchesIfSupported(String, DataField)
instead.Condition
hashMatchesIfSupported(String algorithm, DataField data)
The result may cause anUnsupportedQueryException
when used, if the field is stored in avault
, or thealgorithm
is not supported by the database.StringField
lengthExact(int exactLength)
StringField
lengthMax(int maximumLength)
StringField
lengthMaxUnchecked(int maximumLength)
Deprecated.uselengthMax(int)
.StringField
lengthMin(int minimumLength)
StringField
lengthRange(int minimumLength, int maximumLength)
StringField
noCopyFrom()
Returns a new FunctionField that differs from this FunctionField by having nocopyFrom
fields set.StringField
noDefault()
StringField
nonUnique()
StringField
optional()
Returns a new Field, that differs from this Field by being optional.StringField
toFinal()
Returns a new Field, that differs from this Field by being final.StringField
unique()
Returns a new FunctionField, that differs from this FunctionField by being unique.UppercaseView
uppercase()
Deprecated.renamed toStringFunction.toUpperCase()
-
Methods inherited from class com.exedio.cope.FunctionField
addCopyFrom, append, appendSelect, check, copy, copyFunctionField, get, get, getDefaultConstant, getImplicitCopyConstraint, getImplicitCopyConstraints, getImplicitUniqueConstraint, getUniqueConstraints, hasDefault, isInitial, isRedundantByCopyConstraint, searchUnique, searchUnique, searchUniqueStrict, set
-
Methods inherited from class com.exedio.cope.Field
castCollection, check, execute, getColumnName, getInitialType, getPatterns, getValueClass, isFinal, isMandatory, mapNull
-
Methods inherited from class com.exedio.cope.Feature
afterModelCreated, getAbstractType, getAnnotation, getID, getLocalizationKeys, getName, getPattern, getType, isAnnotationPresent, isSourceAlready, mount, readResolve, requireMounted, toString, toString, writeReplace
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.exedio.cope.Function
any, between, equal, equal, equal, get, get, greater, greater, greaterOrEqual, greaterOrEqual, in, in, isNotNull, isNull, less, less, lessOrEqual, lessOrEqual, max, min, notEqual, notEqual
-
Methods inherited from interface com.exedio.cope.Selectable
append, appendSelect, check, getType, getValueClass, toString
-
Methods inherited from interface com.exedio.cope.StringFunction
bind, contains, containsIgnoreCase, endsWith, endsWithIgnoreCase, equalIgnoreCase, length, like, likeIgnoreCase, startsWith, startsWithIgnoreCase, toUpperCase
-
-
-
-
Field Detail
-
DEFAULT_MINIMUM_LENGTH
public static final int DEFAULT_MINIMUM_LENGTH
- See Also:
- Constant Field Values
-
DEFAULT_MAXIMUM_LENGTH
public static final int DEFAULT_MAXIMUM_LENGTH
- See Also:
- Constant Field Values
-
EMPTY
@Deprecated public static final StringFieldMinimumLength EMPTY
Deprecated.Check carefully, if empty string should really be allowed. If yes, uselengthMin(0)
instead.
-
DEFAULT_LENGTH
@Deprecated public static final int DEFAULT_LENGTH
Deprecated.UseDEFAULT_MAXIMUM_LENGTH
instead- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StringField
public StringField(StringFieldMinimumLength minimumLength)
-
StringField
public StringField()
Creates a new mandatoryStringField
.
-
-
Method Detail
-
copy
public StringField copy()
- Specified by:
copy
in classFunctionField<String>
-
toFinal
public StringField toFinal()
Description copied from class:Field
Returns a new Field, that differs from this Field by being final. If this Field is already final, the the result is equal to this Field.- Specified by:
toFinal
in classFunctionField<String>
- See Also:
Field.isFinal()
-
optional
public StringField optional()
Description copied from class:Field
Returns a new Field, that differs from this Field by being optional. If this Field is already optional, the the result is equal to this Field.- Specified by:
optional
in classFunctionField<String>
- See Also:
Field.isMandatory()
-
unique
public StringField unique()
Description copied from class:FunctionField
Returns a new FunctionField, that differs from this FunctionField by being unique. If this FunctionField is already unique, the the result is equal to this FunctionField.- Specified by:
unique
in classFunctionField<String>
- See Also:
FunctionField.getImplicitUniqueConstraint()
-
nonUnique
public StringField nonUnique()
- Specified by:
nonUnique
in classFunctionField<String>
-
copyFrom
public StringField copyFrom(ItemField<?> copyFrom)
- Specified by:
copyFrom
in classFunctionField<String>
- See Also:
ItemField.copyTo(FunctionField)
-
noCopyFrom
public StringField noCopyFrom()
Description copied from class:FunctionField
Returns a new FunctionField that differs from this FunctionField by having nocopyFrom
fields set.- Specified by:
noCopyFrom
in classFunctionField<String>
-
noDefault
public StringField noDefault()
- Specified by:
noDefault
in classFunctionField<String>
-
defaultTo
public StringField defaultTo(String defaultConstant)
- Specified by:
defaultTo
in classFunctionField<String>
-
lengthRange
public StringField lengthRange(int minimumLength, int maximumLength)
-
lengthMin
public StringField lengthMin(int minimumLength)
-
lengthMax
public StringField lengthMax(int maximumLength)
-
lengthExact
public StringField lengthExact(int exactLength)
-
charSet
public StringField charSet(CharSet charSet)
-
getMinimumLength
public int getMinimumLength()
-
getMaximumLength
public int getMaximumLength()
-
getCharSet
public CharSet getCharSet()
-
getInitialExceptions
public Set<Class<? extends Throwable>> getInitialExceptions()
Description copied from interface:Settable
Returns the exceptions possibly thrown, when setting a value for this settable.- Specified by:
getInitialExceptions
in interfaceSettable<String>
- Overrides:
getInitialExceptions
in classFunctionField<String>
-
getValueType
public com.exedio.cope.SelectType<String> getValueType()
- Specified by:
getValueType
in interfaceSelectable<String>
-
hashMatchesIfSupported
@Nonnull public Condition hashMatchesIfSupported(@Nonnull String algorithm, @Nonnull DataField data)
The result may cause anUnsupportedQueryException
when used, if the field is stored in avault
, or thealgorithm
is not supported by the database.- Parameters:
algorithm
- seeModel.getSupportedDataHashAlgorithms()
- See Also:
hashDoesNotMatchIfSupported(String, DataField)
-
hashDoesNotMatchIfSupported
@Nonnull public Condition hashDoesNotMatchIfSupported(@Nonnull String algorithm, @Nonnull DataField data)
The result may cause anUnsupportedQueryException
when used, if the field is stored in avault
, or thealgorithm
is not supported by the database.
-
hashMatches
@Deprecated @Nonnull public Condition hashMatches(@Nonnull String algorithm, @Nonnull DataField data)
Deprecated.UsehashMatchesIfSupported(String, DataField)
instead.
-
hashDoesNotMatch
@Deprecated @Nonnull public Condition hashDoesNotMatch(@Nonnull String algorithm, @Nonnull DataField data)
Deprecated.UsehashDoesNotMatchIfSupported(String, DataField)
instead.
-
lengthMaxUnchecked
@Deprecated public StringField lengthMaxUnchecked(int maximumLength)
Deprecated.uselengthMax(int)
.
-
uppercase
@Deprecated public UppercaseView uppercase()
Deprecated.renamed toStringFunction.toUpperCase()
-
characterSet
@Deprecated public StringField characterSet(CharacterSet characterSet)
Deprecated.UsecharSet(CharSet)
instead
-
getCharacterSet
@Deprecated public CharacterSet getCharacterSet()
Deprecated.UsegetCharSet()
instead
-
-