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

@OpenApiAll public class Types extends Object
Utility class to work with Type
  • Constructor Details

    • Types

      public Types()
  • Method Details

    • specializes

      public static boolean specializes(Type subType, Type supertype)
      Checks whether the given subtype specializes (is the same as or inherits from) the specified supertype.
      Parameters:
      subType - the type to check
      supertype - the potential supertype
      Returns:
      true if subType is the same as or specializes supertype
    • anyConforms

      public static boolean anyConforms(Collection<Type> subTypes, Collection<Type> superTypes)
      Checks whether any subtype in the given collection conforms to any supertype in the other collection.
      Parameters:
      subTypes - collection of possible subtypes
      superTypes - collection of possible supertypes
      Returns:
      true if at least one subtype conforms to at least one supertype
    • conforms

      public static boolean conforms(Type subtype, Type supertype)
      Checks whether the given subtype conforms to the specified supertype.
      Parameters:
      subtype - the type being checked
      supertype - the type to conform to
      Returns:
      true if subtype conforms to supertype
    • resolveType

      @CheckForNull public static Type resolveType(@CheckForNull Type type)
      Resolves the underlying type if the given type is a Feature, otherwise returns it unchanged.
      Parameters:
      type - the type to resolve
      Returns:
      the resolved type or null
    • getOwnedOrFirstInheritedShortName

      @CheckForNull public static String getOwnedOrFirstInheritedShortName(Type element, ModelElementProject project)
      Retrieves the short name owned by the type or the first inherited short name from a non-standard library supertype.
      Parameters:
      element - the type whose name is requested
      project - the project context
      Returns:
      the short name or null
    • getOwnedOrFirstInheritedName

      @CheckForNull public static String getOwnedOrFirstInheritedName(Type element, ModelElementProject project)
      Retrieves the name owned by the type or the first inherited name from a non-standard library supertype.
      Parameters:
      element - the type whose name is requested
      project - the project context
      Returns:
      the name or null
    • getOwnedOrFirstInheritedStringProperty

      @CheckForNull public static String getOwnedOrFirstInheritedStringProperty(Type element, ModelElementProject project, Function<Type,String> function)
      Retrieves a string property (name, short name, etc.) owned by the type or inherited from the first non-standard-library supertype.
      Parameters:
      element - the type to inspect
      project - the project context
      function - function extracting the string property
      Returns:
      the property value or null
    • getOwnedOrFirstInheritedDocumentationFromNonStandardLibrary

      public static List<Documentation> getOwnedOrFirstInheritedDocumentationFromNonStandardLibrary(Type element, ModelElementProject project)
      Retrieves documentation owned by the type or the first inherited documentation from a non-standard-library supertype.
      Parameters:
      element - the type to inspect
      project - the project context
      Returns:
      a list of documentation entries (never null)
    • getOwnedFeatureByMembership

      @CheckForNull public static <T extends FeatureMembership, F extends Feature> F getOwnedFeatureByMembership(Type type, Class<T> membershipKind)
      Retrieves an owned feature of the given membership kind.
      Type Parameters:
      T - membership type
      F - feature type
      Parameters:
      type - the type to inspect
      membershipKind - the membership class to search for
      Returns:
      the owned feature or null
    • getFeatureMembership

      @CheckForNull public static <T extends FeatureMembership> T getFeatureMembership(Type type, Class<T> membershipKind)
      Retrieves a feature membership of the given kind, searching owned first, then inherited.
      Type Parameters:
      T - membership type
      Parameters:
      type - the type to inspect
      membershipKind - the membership class to search for
      Returns:
      the membership or null
    • getInheritedFeatureMemberships

      public static List<FeatureMembership> getInheritedFeatureMemberships(Type type)
      Retrieves all inherited feature memberships of the given type.
      Parameters:
      type - the type to inspect
      Returns:
      list of inherited feature memberships
    • getFeatureByMembership

      @CheckForNull public static <T extends FeatureMembership, F extends Feature> F getFeatureByMembership(Type type, Class<T> membershipKind)
      Retrieves a feature of the given membership kind, searching owned first, then inherited.
      Type Parameters:
      T - membership type
      F - feature type
      Parameters:
      type - the type to inspect
      membershipKind - the membership class to search for
      Returns:
      the feature or null
    • getFeature

      @CheckForNull public static <F extends Feature> F getFeature(Type type, Class<F> featureKind)
      Retrieves a feature of the given type, searching owned first, then inherited.
      Type Parameters:
      F - feature type
      Parameters:
      type - the type to inspect
      featureKind - the feature class to search for
      Returns:
      the feature or null
    • getFeature

      @CheckForNull public static Feature getFeature(Type type, Predicate<Feature> predicate)
      Retrieves a feature matching the given predicate.
      Parameters:
      type - the type to inspect
      predicate - the filter predicate
      Returns:
      the feature or null
    • getOwnedFeature

      @CheckForNull public static Feature getOwnedFeature(Type type, Predicate<Feature> predicate)
      Retrieves an owned feature matching the given predicate.
      Parameters:
      type - the type to inspect
      predicate - the filter predicate
      Returns:
      the owned feature or null
    • getFeature

      @CheckForNull public static <F extends Feature> F getFeature(Type type, Predicate<F> predicate, Class<F> featureKind)
      Retrieves a feature of the given type matching the predicate, searching owned first, then inherited.
      Type Parameters:
      F - feature type
      Parameters:
      type - the type to inspect
      predicate - the filter predicate
      featureKind - the feature class to search for
      Returns:
      the feature or null
    • isFeatureOf

      public static boolean isFeatureOf(Feature feature, Type type)
      Checks whether the given feature belongs to the specified type.
      Parameters:
      feature - the feature to check
      type - the type to check against
      Returns:
      true if the feature belongs to the type
    • isFeatureOf

      public static boolean isFeatureOf(Feature feature, @CheckForNull Type featureOwningType, Type type)
      Checks whether the given feature belongs to the specified type, using the owning type if available.
      Parameters:
      feature - the feature to check
      featureOwningType - the owning type of the feature (may be null)
      type - the type to check against
      Returns:
      true if the feature belongs to the type