Class ReferentMemberships

java.lang.Object
com.dassault_systemes.modeler.kerml.model.ReferentMemberships

@OpenApiAll public class ReferentMemberships extends Object
Utility class to work with Membership which represent some referent Element
  • Constructor Details

    • ReferentMemberships

      public ReferentMemberships()
  • Method Details

    • getNotFeatureMembership

      @CheckForNull public static Membership getNotFeatureMembership(Type type, Predicate<Element> memberElementPredicate)
      Returns the first owned membership of the type that is not a FeatureMembership and whose member element matches the given predicate.
      Parameters:
      type - the type whose memberships are inspected
      memberElementPredicate - predicate applied to the member element
      Returns:
      matching membership, or null if none found
    • getNotParameterMembership

      @CheckForNull public static Membership getNotParameterMembership(Type type, Predicate<Element> memberElementPredicate)
      Returns the first owned membership of the type that is not a ParameterMembership and whose member element matches the given predicate.
      Parameters:
      type - the type whose memberships are inspected
      memberElementPredicate - predicate applied to the member element
      Returns:
      matching membership, or null if none found
    • setReferent

      public static void setReferent(Type type, @CheckForNull Element referent, int addAtIndex, @CheckForNull Membership currentMembership)
      Sets or removes the referent element for the given type. If referent is null, the existing membership is disposed. Otherwise, a membership is created or reused and updated.
      Parameters:
      type - the type whose referent is modified
      referent - the new referent element, or null to remove
      addAtIndex - index at which to insert a new membership
      currentMembership - existing membership, or null
    • setReferentFeature

      @CheckForNull public static Feature setReferentFeature(Type type, List<? extends Feature> chain, int addAtIndex, @CheckForNull Membership currentMembership)
      Sets the referent feature chain for the given type. Chooses the appropriate membership EClass based on chain length.
      Parameters:
      type - the type whose referent is modified
      chain - feature chain to set
      addAtIndex - index at which to insert a new membership
      currentMembership - existing membership, or null
      Returns:
      the final feature in the chain, or null if none
    • setReferentFeature

      @CheckForNull public static Feature setReferentFeature(Type type, List<? extends Feature> chain, int addAtIndex, org.eclipse.emf.ecore.EClass membershipEClass, @CheckForNull Membership currentMembership)
      Sets the referent feature chain for the given type using the specified membership EClass.
      Parameters:
      type - the type whose referent is modified
      chain - feature chain to set
      addAtIndex - index at which to insert a new membership
      membershipEClass - membership class to use
      currentMembership - existing membership, or null
      Returns:
      the final feature in the chain, or null if none