Class FeatureChainings
java.lang.Object
com.dassault_systemes.modeler.kerml.model.FeatureChainings
Utility class to work with
FeatureChaining-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FeaturecreateAnonymousChainedFeature(Feature... chainingFeatures) Creates an anonymous feature with the given chaining features.static FeatureChainingcreateFeatureChaining(Element owner, Feature chainingFeature, KerMLElementsFactory factory) Creates a FeatureChaining relationship owned by the given element.getChainingFeatureOrSelf(Feature feature) Returns the chaining feature list or the feature itself if no chaining exists.static FeaturegetFirstChainingFeature(Feature chainedFeature) Returns the first chaining feature of the given feature.static <T extends Subsetting>
TgetIncomingSubsettingToAnonymousFeature(Feature anonymous, Class<T> subsettingClass) Returns the incoming subsetting relationship to an anonymous feature.static FeaturegetLastChainingFeature(Feature chainedFeature) Returns the last chaining feature of the given feature.static <R extends Relationship>
FeaturesetSimpleOrChainedRelationshipTarget(R relationship, List<? extends Feature> referenced, Consumer<Feature> relationshipTargetSetter) Set the target of given relationship as chained owned anonymous feature or regular reference.streamOfChainingFeatureOrSelf(Feature feature) Returns a stream of chaining features or the feature itself if no chaining exists.streamOfChainingFeatures(Feature chainedFeature) Returns a stream of chaining features of the given feature.
-
Constructor Details
-
FeatureChainings
public FeatureChainings()
-
-
Method Details
-
setSimpleOrChainedRelationshipTarget
@CheckForNull public static <R extends Relationship> Feature setSimpleOrChainedRelationshipTarget(R relationship, List<? extends Feature> referenced, Consumer<Feature> relationshipTargetSetter) Set the target of given relationship as chained owned anonymous feature or regular reference.- Parameters:
relationship- relationshipreferenced- simple or chained reference to the targetrelationshipTargetSetter- relationship target setter- Returns:
- anonymous feature if reference is chained, otherwise first feature from a given list
-
streamOfChainingFeatureOrSelf
Returns a stream of chaining features or the feature itself if no chaining exists.- Parameters:
feature- feature- Returns:
- stream of chaining features or self
-
getChainingFeatureOrSelf
Returns the chaining feature list or the feature itself if no chaining exists.- Parameters:
feature- feature- Returns:
- list of chaining features or singleton list of feature
-
getIncomingSubsettingToAnonymousFeature
@CheckForNull public static <T extends Subsetting> T getIncomingSubsettingToAnonymousFeature(Feature anonymous, Class<T> subsettingClass) Returns the incoming subsetting relationship to an anonymous feature.- Type Parameters:
T- subsetting type- Parameters:
anonymous- anonymous featuresubsettingClass- expected subsetting class- Returns:
- incoming subsetting, or null
-
streamOfChainingFeatures
Returns a stream of chaining features of the given feature.- Parameters:
chainedFeature- feature with chaining- Returns:
- stream of chaining features
-
getFirstChainingFeature
Returns the first chaining feature of the given feature.- Parameters:
chainedFeature- feature- Returns:
- first chaining feature, or null
-
getLastChainingFeature
Returns the last chaining feature of the given feature.- Parameters:
chainedFeature- feature- Returns:
- last chaining feature, or null
-
createAnonymousChainedFeature
Creates an anonymous feature with the given chaining features.- Parameters:
chainingFeatures- features to chain- Returns:
- created anonymous feature
-
createFeatureChaining
public static FeatureChaining createFeatureChaining(Element owner, Feature chainingFeature, KerMLElementsFactory factory) Creates a FeatureChaining relationship owned by the given element.- Parameters:
owner- owner of the chainingchainingFeature- feature to chainfactory- factory for creating elements- Returns:
- created FeatureChaining
-