public class PolicyAssociation extends Association
PolicyCmptTypes.IModelTypeAssociation.AssociationType| Constructor and Description |
|---|
PolicyAssociation(Type type,
Method getterMethod,
Method addMethod,
Method removeMethod) |
| Modifier and Type | Method and Description |
|---|---|
<S extends IModelObject> |
addTargetObjects(S source,
Collection<IModelObject> targets)
Adds the target objects to this association in the source object.
|
<S extends IModelObject> |
addTargetObjects(S source,
IModelObject... targets)
Adds the target objects to this association in the source object.
|
PolicyAssociation |
createOverwritingAssociationFor(Type subType) |
ProductCmptType |
getMatchingAssociationSourceType()
Returns the
ProductCmptType identified by Association.getMatchingAssociationSource() |
PolicyCmptType |
getModelType()
Deprecated.
Use
getType() |
PolicyAssociation |
getSuperAssociation()
Returns the association that is overridden by this association if this association overrides
another one.
|
PolicyCmptType |
getTarget()
Returns the target
Type of this association. |
List<IModelObject> |
getTargetObjects(IModelObject source)
Returns a list of the target(s) of the given model object's association identified by this
model type association.
|
PolicyCmptType |
getType()
Returns the
PolicyCmptType this association belongs to. |
<S extends IModelObject> |
removeTargetObjects(S source,
IModelObject... targetsToRemove)
Removes the target objects from this association in the source object.
|
<S extends IModelObject> |
removeTargetObjects(S source,
List<IModelObject> targetsToRemove)
Removes the target object from this association in the source object.
|
getAssociationKind, getAssociationType, getGetterMethod, getInverseAssociation, getLabelForPlural, getMatchingAssociation, getMatchingAssociationName, getMatchingAssociationSource, getMaxCardinality, getMinCardinality, getNamePlural, getUsedName, isDerivedUnion, isMatchingAssociationPresent, isOverriding, isProductRelevant, isSubsetOfADerivedUnion, isToOneAssociation, toStringgetMessageHelper, getMessageKey, getTypeNamecreateMessageHelper, getDescription, getDocumentation, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRelevantProductObject, invokeField, invokeMethodclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDescription, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getNamepublic PolicyAssociation(Type type, Method getterMethod, Method addMethod, Method removeMethod)
type - the type the association belongs togetterMethod - the getter method for retrieving all associated instancesaddMethod - the method for associating new instances (add-method for ..N associations,
set-method for ..1 associations)removeMethod - the method for removing instances from the association (null
in case of a ..1 association, as no method is generated)public PolicyCmptType getType()
PolicyCmptType this association belongs to.@Deprecated public PolicyCmptType getModelType()
getType()getModelType in interface IModelTypeAssociationgetModelType in class TypePartpublic PolicyAssociation createOverwritingAssociationFor(Type subType)
createOverwritingAssociationFor in class Associationpublic ProductCmptType getMatchingAssociationSourceType()
ProductCmptType identified by Association.getMatchingAssociationSource()getMatchingAssociationSourceType in interface IModelTypeAssociationgetMatchingAssociationSourceType in class AssociationAssociation.getMatchingAssociationSource()public PolicyCmptType getTarget()
AssociationType of this association.getTarget in interface IModelTypeAssociationgetTarget in class Associationpublic List<IModelObject> getTargetObjects(IModelObject source)
source - a model object corresponding to the PolicyCmptType this association
belongs toIllegalArgumentException - if the model object does not have an association fitting
this model type association or that association is not accessible for any reasonpublic <S extends IModelObject> S addTargetObjects(S source, Collection<IModelObject> targets)
The return value is the updated source object. It could be used to directly create a tree of objects. For example with a model like:
Policy <>---- Contract <>---- Coverage
You could write such code:
contracts.addTargetObjects(policy,
coverages.addTargetObjects(contract,
coverage1, coverage2));
source - the object to add a target object totargets - the objects to add to sourceIllegalArgumentException - if there is no method annotated with
@IpsAssociationAdder. This is the case if the
association is a derived union.IllegalArgumentException - if there are multiple target objects provided for a ..1 ("to
one") associationpublic <S extends IModelObject> S addTargetObjects(S source, IModelObject... targets)
The return value is the updated source object. It could be used to directly create a tree of objects. For example with a model like:
Policy <>---- Contract <>---- Coverage
You could write such code:
contracts.addTargetObjects(policy,
coverages.addTargetObjects(contract,
coverage1, coverage2));
source - the object to add a target object totargets - the objects to add to sourceIllegalArgumentException - if there is no method annotated with
@IpsAssociationAdder. This is the case if the
association is a derived union.IllegalArgumentException - if there are multiple target objects provided for a ..1 ("to
one") associationpublic <S extends IModelObject> S removeTargetObjects(S source, List<IModelObject> targetsToRemove)
null if
this is a ..1 ("to one") association.
The return value is the updated source object. It could be used to directly remove objects in a tree of objects. For example with a model like:
Policy <>---- Contract <>---- Coverage
You could write such code:
contracts.removeTargetObjects(policy,
coverages.removeTargetObjects(contract,
coverage1, coverage2));
source - the object to remove a target object fromtargetsToRemove - the objects to remove from this association in sourceIllegalArgumentException - if there is no method annotated with
@IpsAssociationRemover (or
@IpsAssociationAdder for a ..1 association). This is
the case if the association is a derived union.IllegalArgumentException - if there are multiple or no target objects provided for a
..1 ("to one") associationpublic PolicyAssociation getSuperAssociation()
Associationnull.getSuperAssociation in class AssociationAssociation.isOverriding()public <S extends IModelObject> S removeTargetObjects(S source, IModelObject... targetsToRemove)
null if
this is a ..1 ("to one") association.
The return value is the updated source object. It could be used to directly remove objects in a tree of objects. For example with a model like:
Policy <>---- Contract <>---- Coverage
You could write such code:
contracts.removeTargetObjects(policy,
coverages.removeTargetObjects(contract,
coverage1, coverage2));
source - the object to remove a target object fromtargetsToRemove - the objects to remove from this association in sourceIllegalArgumentException - if there is no method annotated with
@IpsAssociationRemover (or
@IpsAssociationAdder for a ..1 association). This is
the case if the association is a derived union.IllegalArgumentException - if there are multiple target objects provided for a ..1 ("to
one") associationCopyright © 2020. All rights reserved.