Class ReferentMemberships
java.lang.Object
com.dassault_systemes.modeler.kerml.model.ReferentMemberships
Utility class to work with
Membership which represent some referent Element-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MembershipgetNotFeatureMembership(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.static MembershipgetNotParameterMembership(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.static voidsetReferent(Type type, Element referent, int addAtIndex, Membership currentMembership) Sets or removes the referent element for the given type.static FeaturesetReferentFeature(Type type, List<? extends Feature> chain, int addAtIndex, Membership currentMembership) Sets the referent feature chain for the given type.static FeaturesetReferentFeature(Type type, List<? extends Feature> chain, int addAtIndex, org.eclipse.emf.ecore.EClass membershipEClass, Membership currentMembership) Sets the referent feature chain for the given type using the specified membership EClass.
-
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 inspectedmemberElementPredicate- 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 inspectedmemberElementPredicate- 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 modifiedreferent- the new referent element, or null to removeaddAtIndex- index at which to insert a new membershipcurrentMembership- 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 modifiedchain- feature chain to setaddAtIndex- index at which to insert a new membershipcurrentMembership- 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 modifiedchain- feature chain to setaddAtIndex- index at which to insert a new membershipmembershipEClass- membership class to usecurrentMembership- existing membership, or null- Returns:
- the final feature in the chain, or null if none
-