Package com.exedio.cope.pattern
Class SetField<E>
java.lang.Object
com.exedio.cope.Feature
com.exedio.cope.Pattern
com.exedio.cope.pattern.SetField<E>
- All Implemented Interfaces:
Copyable
,Serializable
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
copy
(CopyMapper mapper) copyWith
(FunctionField<?> copyWith) Returns a new SetField, that differs from this SetField by enforcing that parent and element items have the same value in the given field.static <E> SetField<E>
create
(FunctionField<E> element) <T> FunctionField<T>
getCopyWithCopyField
(FunctionField<T> template) Get the field that stores a redudant copy of a parent item's value at the relation item, to enforce aCopyConstraint
added withcopyWith(FunctionField)
.List<FunctionField<?>>
Get the template fields added withcopyWith(FunctionField)
.getOrder()
ItemField<?>
getParents
(Class<P> parentClass, E element) Returns the items, for which this field set contains the given element.Type<?>
boolean
Returns whether thisSetField
is ordered.static <E> SetField<E>
newSet
(FunctionField<E> element) Deprecated.protected void
onMount()
Here you can do additional initialization not yet done in the constructor.ordered()
Returns a new SetField, that differs from this SetField by beingordered
.boolean
void
set
(Item item, Collection<? extends E> value) void
setAndCast
(Item item, Collection<?> value) Methods inherited from class com.exedio.cope.Pattern
addSource, addSource, addSource, addSource, addSourceFeature, addSourceFeature, addSourceFeature, annotationField, equals, getGeneratedTypes, getSourceFeatures, getSourceFeaturesGather, getSourceFields, getSources, getSourceTypes, getType, hashCode, initialize, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newType, newType, registerSource
Methods inherited from class com.exedio.cope.Feature
afterModelCreated, getAbstractType, getAnnotation, getID, getLocalizationKeys, getName, getPattern, isAnnotationPresent, isSourceAlready, mount, readResolve, requireMounted, toString, toString, writeReplace
-
Method Details
-
create
-
copy
-
ordered
Returns a new SetField, that differs from this SetField by beingordered
. -
copyWith
Returns a new SetField, that differs from this SetField by enforcing that parent and element items have the same value in the given field.- Throws:
IllegalStateException
- if theelement
field is not anItemField
IllegalArgumentException
- if the field given as parameter is not final
-
onMount
protected void onMount()Description copied from class:Pattern
Here you can do additional initialization not yet done in the constructor. In this method you can call methodsPattern.getType()
andFeature.getName()
for the first time. -
getParent
-
getParent
-
isOrdered
public boolean isOrdered()Returns whether thisSetField
is ordered. An orderedSetField
maintains the insertion order of its elements. -
getOrder
-
getUniqueConstraintForOrder
-
getElement
-
getUniqueConstraint
-
getRelationType
-
getCopyWithTemplateFields
Get the template fields added withcopyWith(FunctionField)
. -
getCopyWithCopyField
Get the field that stores a redudant copy of a parent item's value at the relation item, to enforce aCopyConstraint
added withcopyWith(FunctionField)
.- Throws:
IllegalArgumentException
- if the field given as parameter does not belong to this SetField'stype
.IllegalStateException
- if there is no CopyConstraint on the given field
-
get
-
getQuery
-
getParents
@Nonnull public <P extends Item> List<P> getParents(@Nonnull Class<P> parentClass, @Nonnull E element) Returns the items, for which this field set contains the given element. The order of the result is unspecified. -
add
- Returns:
true
if the result ofget(Item)
changed as a result of the call.
-
remove
- Returns:
true
if the result ofget(Item)
changed as a result of the call.
-
set
-
setAndCast
-
newSet
Deprecated.Usecreate(FunctionField)
instead
-
create(FunctionField)
instead