Class FeatureChainings

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

@OpenApiAll public class FeatureChainings extends Object
Utility class to work with FeatureChaining
  • 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 - relationship
      referenced - simple or chained reference to the target
      relationshipTargetSetter - relationship target setter
      Returns:
      anonymous feature if reference is chained, otherwise first feature from a given list
    • streamOfChainingFeatureOrSelf

      public static Stream<Feature> streamOfChainingFeatureOrSelf(Feature feature)
      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

      public static List<Feature> getChainingFeatureOrSelf(Feature feature)
      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 feature
      subsettingClass - expected subsetting class
      Returns:
      incoming subsetting, or null
    • streamOfChainingFeatures

      public static Stream<Feature> streamOfChainingFeatures(Feature chainedFeature)
      Returns a stream of chaining features of the given feature.
      Parameters:
      chainedFeature - feature with chaining
      Returns:
      stream of chaining features
    • getFirstChainingFeature

      @CheckForNull public static Feature getFirstChainingFeature(Feature chainedFeature)
      Returns the first chaining feature of the given feature.
      Parameters:
      chainedFeature - feature
      Returns:
      first chaining feature, or null
    • getLastChainingFeature

      @CheckForNull public static Feature getLastChainingFeature(Feature chainedFeature)
      Returns the last chaining feature of the given feature.
      Parameters:
      chainedFeature - feature
      Returns:
      last chaining feature, or null
    • createAnonymousChainedFeature

      public static Feature createAnonymousChainedFeature(Feature... chainingFeatures)
      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 chaining
      chainingFeature - feature to chain
      factory - factory for creating elements
      Returns:
      created FeatureChaining