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 TypeMethodDescriptionbooleancopy(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 aCopyConstraintadded 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<?>booleanReturns whether thisSetFieldis ordered.static <E> SetField<E>newSet(FunctionField<E> element) Deprecated.protected voidonMount()Here you can do additional initialization not yet done in the constructor.ordered()Returns a new SetField, that differs from this SetField by beingordered.booleanvoidset(Item item, Collection<? extends E> value) voidsetAndCast(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, registerSourceMethods 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 theelementfield is not anItemFieldIllegalArgumentException- if the field given as parameter is not final
-
onMount
protected void onMount()Description copied from class:PatternHere 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 thisSetFieldis ordered. An orderedSetFieldmaintains 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 aCopyConstraintadded 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:
trueif the result ofget(Item)changed as a result of the call.
-
remove
- Returns:
trueif the result ofget(Item)changed as a result of the call.
-
set
-
setAndCast
-
newSet
Deprecated.Usecreate(FunctionField)instead
-
create(FunctionField)instead