Class Association
- java.lang.Object
-
- org.faktorips.runtime.model.type.ModelElement
-
- org.faktorips.runtime.model.type.TypePart
-
- org.faktorips.runtime.model.type.Association
-
- Direct Known Subclasses:
PolicyAssociation,ProductAssociation
public abstract class Association extends TypePart
An association between twoTypes.
-
-
Constructor Summary
Constructors Constructor Description Association(Type type, java.lang.reflect.Method getterMethod)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AssociationcreateOverwritingAssociationFor(Type subType)java.util.Optional<? extends Association>findMatchingAssociation()Returns the matching product respectively policy component type association or anempty Optionalif no matching association is defined for this association.java.util.Optional<Association>findSuperAssociation()Returns the association that is overridden by this association if this association overrides another one.AssociationKindgetAssociationKind()Returns what kind of association this is.protected java.lang.reflect.MethodgetGetterMethod()java.lang.StringgetInverseAssociation()Returns the name of the inverse association if it is defined.java.lang.StringgetLabelForPlural(java.util.Locale locale)Returns the plural label for this model element in the specified locale.AssociationgetMatchingAssociation()Returns the matching product respectively policy component type association ornullif no matching association is defined for this association.java.lang.StringgetMatchingAssociationName()Returns the name of the matching product respectively policy component type association ornullif no matching association is defined for this association.java.lang.StringgetMatchingAssociationSource()Returns the qualified name of source type of the matching association ornullif no matching association is defined.TypegetMatchingAssociationSourceType()Returns theTypeidentified bygetMatchingAssociationSource()intgetMaxCardinality()Returns the maximum cardinality for this association.intgetMinCardinality()Returns the minimum cardinality for this association.java.lang.StringgetNamePlural()Returns the plural form of this model type's name or the empty String if no plural for the name is set.AssociationgetSuperAssociation()Returns the association that is overridden by this association if this association overrides another one.TypegetTarget()Returns the targetTypeof this association.java.lang.StringgetUsedName()Returns the singular or plural form of this association's name as used in code generation depending on cardinality.booleanisDerivedUnion()Returns if this association is a derived union.booleanisMatchingAssociationPresent()Returnstrueif the association has a matching association.booleanisOverriding()Returnstrueif this association overrides another association.booleanisSubsetOfADerivedUnion()Returns if this association is a subset of a derived union.protected booleanisToOneAssociation()Determines whether this association is a ..1 ("to one") association.java.lang.StringtoString()-
Methods inherited from class org.faktorips.runtime.model.type.TypePart
getMessageHelper, getMessageKey, getModelType, getType, getTypeName
-
Methods inherited from class org.faktorips.runtime.model.type.ModelElement
createMessageHelper, getDescription, getDocumentation, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRelevantProductObject, invokeField, invokeMethod
-
-
-
-
Constructor Detail
-
Association
public Association(Type type, java.lang.reflect.Method getterMethod)
-
-
Method Detail
-
getLabelForPlural
public java.lang.String getLabelForPlural(java.util.Locale locale)
Returns the plural label for this model element in the specified locale. If there is no plural label in the specified locale, it tries to find the plural label in the default locale. If there is also no plural label in the default locale the element's plural name is returned.- Returns:
- the label for the given locale or the element's name if no label exists for the given locale nor in the default locale
-
getAssociationKind
public AssociationKind getAssociationKind()
Returns what kind of association this is.
-
getMinCardinality
public int getMinCardinality()
Returns the minimum cardinality for this association.0if no minimum is set.
-
getMaxCardinality
public int getMaxCardinality()
Returns the maximum cardinality for this association.Integer.MAX_VALUEif no maximum is set.
-
getNamePlural
public java.lang.String getNamePlural()
Returns the plural form of this model type's name or the empty String if no plural for the name is set.
-
getUsedName
public java.lang.String getUsedName()
Returns the singular or plural form of this association's name as used in code generation depending on cardinality.
-
isDerivedUnion
public boolean isDerivedUnion()
Returns if this association is a derived union.
-
isSubsetOfADerivedUnion
public boolean isSubsetOfADerivedUnion()
Returns if this association is a subset of a derived union.
-
getInverseAssociation
public java.lang.String getInverseAssociation()
Returns the name of the inverse association if it is defined.- Returns:
- The name of the inverse association or
nullif there is no inverse association or it is a product component associations
-
isMatchingAssociationPresent
public boolean isMatchingAssociationPresent()
Returnstrueif the association has a matching association. For policy associations that means it is configured by the product component. For product component associations that means it configures a policy association.- Returns:
trueif this association has a matching association.- See Also:
getMatchingAssociationName()
-
getMatchingAssociationName
public java.lang.String getMatchingAssociationName()
Returns the name of the matching product respectively policy component type association ornullif no matching association is defined for this association.Example: Taking two policy component types called 'Policy' and 'Coverage' with a composition association between them. Policy is constrained by the product component type 'Product' and coverage by 'CoverageType'. There is also an association from 'Product' to 'CoverageType'. The product association configures the policy association. If this is a model type association for the policy association this method returns the name of the matching product association and vice versa.
- Returns:
- The name of the matching association
-
getMatchingAssociation
public Association getMatchingAssociation()
Returns the matching product respectively policy component type association ornullif no matching association is defined for this association.Example: Taking two policy component types called 'Policy' and 'Coverage' with a composition association between them. Policy is constrained by the product component type 'Product' and coverage by 'CoverageType'. There is also an association from 'Product' to 'CoverageType'. The product association configures the policy association. If this is a association for the policy association this method returns the matching product association and vice versa.
- Returns:
- The matching association
-
findMatchingAssociation
public java.util.Optional<? extends Association> findMatchingAssociation()
Returns the matching product respectively policy component type association or anempty Optionalif no matching association is defined for this association.Example: Taking two policy component types called 'Policy' and 'Coverage' with a composition association between them. Policy is constrained by the product component type 'Product' and coverage by 'CoverageType'. There is also an association from 'Product' to 'CoverageType'. The product association configures the policy association. If this is a association for the policy association this method returns the matching product association and vice versa.
- Returns:
- The matching association
-
getMatchingAssociationSource
public java.lang.String getMatchingAssociationSource()
Returns the qualified name of source type of the matching association ornullif no matching association is defined.Example: Taking two policy component types called 'Policy' and 'Coverage' with a composition association between them. Policy is constrained by the product component type 'Product' and coverage by 'CoverageType'. There is also an association from 'Product' to 'CoverageType'. The product association configures the policy association. If this is a model type association for the policy association this method returns the qualified name of the source of the matching product association and vice versa. The source is the type which defines the matching association.
- Returns:
- The qualified name of the matching association source
-
getMatchingAssociationSourceType
public Type getMatchingAssociationSourceType()
Returns theTypeidentified bygetMatchingAssociationSource()- Returns:
- The
Typeof the matching association source - See Also:
getMatchingAssociationSource()
-
isOverriding
public boolean isOverriding()
Returnstrueif this association overrides another association. That means a supertype declares an association with the same name.- Returns:
trueif this association overrides another,falseif not- See Also:
getSuperAssociation()
-
getSuperAssociation
public Association getSuperAssociation()
Returns the association that is overridden by this association if this association overrides another one. Otherwise returnsnull.- Returns:
- The association that is overridden by this attribute.
- See Also:
isOverriding()
-
findSuperAssociation
public java.util.Optional<Association> findSuperAssociation()
Returns the association that is overridden by this association if this association overrides another one. Otherwise returns anempty Optional.- Returns:
- The association that is overridden by this attribute.
- See Also:
isOverriding()
-
getGetterMethod
protected java.lang.reflect.Method getGetterMethod()
-
createOverwritingAssociationFor
public abstract Association createOverwritingAssociationFor(Type subType)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classModelElement
-
isToOneAssociation
protected boolean isToOneAssociation()
Determines whether this association is a ..1 ("to one") association.- Returns:
trueif this is a ..1 association,falseelse.
-
-