Class Association

Direct Known Subclasses:
PolicyAssociation, ProductAssociation

public abstract class Association extends TypePart
An association between two Types.
  • Field Details

  • Constructor Details

    • Association

      public Association(Type type, Method getter)
  • Method Details

    • getLabelForPlural

      public String getLabelForPlural(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. 0 if no minimum is set.
    • getMaxCardinality

      public int getMaxCardinality()
      Returns the maximum cardinality for this association. Integer.MAX_VALUE if no maximum is set.
    • getNamePlural

      public String getNamePlural()
      Returns the plural form of this model type's name or the empty String if no plural for the name is set.
    • getTarget

      public Type getTarget()
      Returns the target Type of this association.
    • getUsedName

      public 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 String getInverseAssociation()
      Returns the name of the inverse association if it is defined.
      Returns:
      The name of the inverse association or null if there is no inverse association or it is a product component associations
    • isMatchingAssociationPresent

      public boolean isMatchingAssociationPresent()
      Returns true if 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:
      true if this association has a matching association.
      See Also:
    • getMatchingAssociationName

      public String getMatchingAssociationName()
      Returns the name of the matching product respectively policy component type association or null if 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 or null if 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 Optional<? extends Association> findMatchingAssociation()
      Returns the matching product respectively policy component type association or an empty Optional if 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 String getMatchingAssociationSource()
      Returns the qualified name of source type of the matching association or null if 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 the Type identified by getMatchingAssociationSource()
      Returns:
      The Type of the matching association source
      See Also:
    • isOverriding

      public boolean isOverriding()
      Returns true if this association overrides another association. That means a supertype declares an association with the same name.
      Returns:
      true if this association overrides another, false if not
      See Also:
    • getSuperAssociation

      public Association getSuperAssociation()
      Returns the association that is overridden by this association if this association overrides another one. Otherwise returns null.
      Returns:
      The association that is overridden by this attribute.
      See Also:
    • findSuperAssociation

      public Optional<Association> findSuperAssociation()
      Returns the association that is overridden by this association if this association overrides another one. Otherwise returns an empty Optional.
      Returns:
      The association that is overridden by this attribute.
      See Also:
    • getGetterMethod

      protected Method getGetterMethod()
    • validate

      protected <V, R> void validate(MessageList list, IValidationContext context, Supplier<V> valueGetter, Supplier<R> referenceValueGetter, BiPredicate<V,R> valueChecker, String msgCode, String msgKey, String property, ObjectProperty invalidObjectProperty)
    • validate

      protected <V, R> void validate(MessageList list, Supplier<V> valueGetter, Supplier<R> referenceValueGetter, BiPredicate<V,R> valueChecker, BiFunction<V,R,String> messageTextGetter, String msgCode, ObjectProperty... invalidObjectProperties)
    • createOverwritingAssociationFor

      public abstract Association createOverwritingAssociationFor(Type subType)
    • toString

      public String toString()
      Overrides:
      toString in class ModelElement
    • isToOneAssociation

      protected boolean isToOneAssociation()
      Determines whether this association is a ..1 ("to one") association.
      Returns:
      true if this is a ..1 association, false else.
    • getAnnotation

      protected IpsAssociation getAnnotation()
    • getDocumentation

      protected String getDocumentation(Locale locale, DocumentationKind type, String fallback)
      Overrides:
      getDocumentation in class ModelElement
    • getResourceBundleName

      protected String getResourceBundleName()