Package com.exedio.cope.pattern
Class ListField<E>
java.lang.Object
com.exedio.cope.Feature
com.exedio.cope.Pattern
com.exedio.cope.pattern.AbstractListField<E>
com.exedio.cope.pattern.ListField<E>
- All Implemented Interfaces:
Copyable,Serializable
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidcopy(CopyMapper mapper) copyWith(FunctionField<?> copyWith) Returns a new ListField, that differs from this ListField by enforcing that parent and element items have the same value in the given field.static <E> ListField<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).getDistinctParents(Class<P> parentClass, E element) Returns the items, for which this field list contains the given element.getOrder()ItemField<?>Returns the query that is used to implementget(Item).Type<?>static <E> ListField<E>newList(FunctionField<E> element) Deprecated.protected voidonMount()Here you can do additional initialization not yet done in the constructor.booleanvoidset(Item item, Collection<? extends E> value) Methods inherited from class com.exedio.cope.pattern.AbstractListField
getMaximumSize, setAndCastMethods 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
-
copyWith
Returns a new ListField, that differs from this ListField 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
-
getOrder
-
getUniqueConstraint
-
getElement
- Specified by:
getElementin classAbstractListField<E>
-
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 ListField'stype.IllegalStateException- if there is no CopyConstraint on the given field
-
get
- Specified by:
getin classAbstractListField<E>- See Also:
-
getQuery
Returns the query that is used to implementget(Item). -
getDistinctParents
@Nonnull public <P extends Item> List<P> getDistinctParents(@Nonnull Class<P> parentClass, E element) Returns the items, for which this field list contains the given element. The result does not contain any duplicates, even if the element is contained in this field list for an item more than once. The order of the result is unspecified. -
add
-
removeAll
- Returns:
trueif the result ofget(Item)changed as a result of the call.
-
set
- Specified by:
setin classAbstractListField<E>
-
newList
Deprecated.Usecreate(FunctionField)instead
-
create(FunctionField)instead