Package com.exedio.cope
Class FunctionField<E>
- java.lang.Object
-
- com.exedio.cope.Feature
-
- com.exedio.cope.Field<E>
-
- com.exedio.cope.FunctionField<E>
-
- All Implemented Interfaces:
Copyable
,Function<E>
,Selectable<E>
,Settable<E>
,Serializable
- Direct Known Subclasses:
BooleanField
,DateField
,DayField
,EnumField
,ItemField
,NumberField
,StringField
public abstract class FunctionField<E> extends Field<E> implements Function<E>, Copyable
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected ItemField<?>[]
addCopyFrom(ItemField<?> copyFrom)
void
append(com.exedio.cope.Statement bf, Join join)
Deprecated.For internal use within COPE only.void
appendSelect(com.exedio.cope.Statement bf, Join join)
Deprecated.For internal use within COPE only.void
check(com.exedio.cope.TC tc, Join join)
Deprecated.For internal use within COPE only.abstract FunctionField<E>
copy()
FunctionField<E>
copy(CopyMapper mapper)
abstract FunctionField<E>
copyFrom(ItemField<?> copyFrom)
FunctionField<E>
copyFunctionField()
Deprecated.Renamed tocopy()
.abstract FunctionField<E>
defaultTo(E defaultConstant)
E
get(FieldValues item)
E
get(Item item)
E
getDefaultConstant()
CopyConstraint
getImplicitCopyConstraint()
Deprecated.UsegetImplicitCopyConstraints()
instead.List<CopyConstraint>
getImplicitCopyConstraints()
Deprecated.This method makes no sense anymore, since there is aItemField.copyTo(FunctionField)
as well.UniqueConstraint
getImplicitUniqueConstraint()
Returns the unique constraint of this field, that has been created implicitly when creating this field.Set<Class<? extends Throwable>>
getInitialExceptions()
Returns the exceptions possibly thrown, when setting a value for this settable.List<UniqueConstraint>
getUniqueConstraints()
Returns a list of unique constraints this field is part of.boolean
hasDefault()
boolean
isInitial()
Returns true, if a value for the field should be specified on the creation of an item.boolean
isRedundantByCopyConstraint()
abstract FunctionField<E>
noCopyFrom()
Returns a new FunctionField that differs from this FunctionField by having nocopyFrom
fields set.abstract FunctionField<E>
noDefault()
abstract FunctionField<E>
nonUnique()
abstract FunctionField<E>
optional()
Returns a new Field, that differs from this Field by being optional.Item
searchUnique(E value)
Finds an item by it's unique fields.<P extends Item>
PsearchUnique(Class<P> typeClass, E value)
Finds an item by it's unique fields.<P extends Item>
PsearchUniqueStrict(Class<P> typeClass, E value)
Finds an item by its unique fields.void
set(Item item, E value)
abstract FunctionField<E>
toFinal()
Returns a new Field, that differs from this Field by being final.abstract FunctionField<E>
unique()
Returns a new FunctionField, that differs from this FunctionField by being unique.-
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, bind, equal, equal, equal, greater, greater, greaterOrEqual, greaterOrEqual, in, in, isNotNull, isNull, less, less, lessOrEqual, lessOrEqual, max, min, notEqual, notEqual
-
Methods inherited from interface com.exedio.cope.Selectable
getType, getValueClass, getValueType, toString
-
-
-
-
Method Detail
-
hasDefault
public final boolean hasDefault()
-
getDefaultConstant
public final E getDefaultConstant()
-
isInitial
public final boolean isInitial()
Returns true, if a value for the field should be specified on the creation of an item. This implementation returns({@link #isFinal() isFinal()} || {@link #isMandatory() isMandatory()}) && !{@link #hasDefault()}
.
-
toFinal
public abstract FunctionField<E> 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 classField<E>
- See Also:
Field.isFinal()
-
optional
public abstract FunctionField<E> 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 classField<E>
- See Also:
Field.isMandatory()
-
copy
public abstract FunctionField<E> copy()
-
copy
public final FunctionField<E> copy(CopyMapper mapper)
-
unique
public abstract FunctionField<E> unique()
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.- See Also:
getImplicitUniqueConstraint()
-
nonUnique
public abstract FunctionField<E> nonUnique()
-
copyFrom
public abstract FunctionField<E> copyFrom(ItemField<?> copyFrom)
- See Also:
ItemField.copyTo(FunctionField)
-
noCopyFrom
public abstract FunctionField<E> noCopyFrom()
Returns a new FunctionField that differs from this FunctionField by having nocopyFrom
fields set.
-
noDefault
public abstract FunctionField<E> noDefault()
-
defaultTo
public abstract FunctionField<E> defaultTo(E defaultConstant)
-
get
public final E get(FieldValues item)
-
check
@Deprecated public final void check(com.exedio.cope.TC tc, Join join)
Deprecated.For internal use within COPE only.- Specified by:
check
in interfaceSelectable<E>
-
append
@Deprecated public final void append(com.exedio.cope.Statement bf, Join join)
Deprecated.For internal use within COPE only.- Specified by:
append
in interfaceSelectable<E>
-
appendSelect
@Deprecated public void appendSelect(com.exedio.cope.Statement bf, Join join)
Deprecated.For internal use within COPE only.- Specified by:
appendSelect
in interfaceSelectable<E>
-
getImplicitUniqueConstraint
public UniqueConstraint getImplicitUniqueConstraint()
Returns the unique constraint of this field, that has been created implicitly when creating this field. Does return null, if there is no such unique constraint.- See Also:
getUniqueConstraints()
,unique()
-
getUniqueConstraints
public List<UniqueConstraint> getUniqueConstraints()
Returns a list of unique constraints this field is part of. This includes animplicit unique constraint
, if there is one for this field.
-
getImplicitCopyConstraint
@Deprecated public CopyConstraint getImplicitCopyConstraint()
Deprecated.UsegetImplicitCopyConstraints()
instead. Throws a RuntimeException, ifgetImplicitCopyConstraints()
returns more than one constraint.Returns the copy constraint of this field, that has been created implicitly when creating this field. Does return null, if there is no such copy constraint.
-
getImplicitCopyConstraints
@Deprecated public List<CopyConstraint> getImplicitCopyConstraints()
Deprecated.This method makes no sense anymore, since there is aItemField.copyTo(FunctionField)
as well.Returns the copy constraints of this field, that has been created implicitly when creating this field. Does return an empty list, if there is no such copy constraint.
-
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<E>
- Overrides:
getInitialExceptions
in classField<E>
-
isRedundantByCopyConstraint
public final boolean isRedundantByCopyConstraint()
-
searchUnique
public final Item searchUnique(E value)
Finds an item by it's unique fields.- Returns:
- null if there is no matching item.
- Throws:
NullPointerException
- if value is null.
-
searchUnique
@Nullable public final <P extends Item> P searchUnique(Class<P> typeClass, @Nonnull E value)
Finds an item by it's unique fields.- Returns:
- null if there is no matching item.
- Throws:
NullPointerException
- if value is null.
-
searchUniqueStrict
@Nonnull public final <P extends Item> P searchUniqueStrict(Class<P> typeClass, @Nonnull E value) throws IllegalArgumentException
Finds an item by its unique fields.- Throws:
NullPointerException
- if value is null.IllegalArgumentException
- if there is no matching item.
-
copyFunctionField
@Deprecated public final FunctionField<E> copyFunctionField()
Deprecated.Renamed tocopy()
.
-
-