Class Specializations

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

@OpenApiAll public class Specializations extends Object
Utility class to work with Specialization and Type
  • Constructor Details

    • Specializations

      public Specializations()
  • Method Details

    • streamOfSubTypes

      public static Stream<Type> streamOfSubTypes(Type type, Class<? extends Specialization> specializationKind)
      Returns a stream of subtypes of the given type using the specified specialization kind.
      Parameters:
      type - the type whose subtypes are requested
      specializationKind - the specialization class to filter by
      Returns:
      stream of subtypes
    • firstSuperTypeMatching

      @CheckForNull public static <T extends Type> T firstSuperTypeMatching(Type type, Predicate<Type> predicate, Class<T> typeClass)
      Returns the first supertype of the given type that matches the predicate and is an instance of the specified class.
      Type Parameters:
      T - supertype type
      Parameters:
      type - the type whose supertypes are inspected
      predicate - condition the supertype must satisfy
      typeClass - class the supertype must be an instance of
      Returns:
      the first matching supertype, or null
    • forEachSuperType

      public static void forEachSuperType(Type type, Consumer<Type> consumer)
      Applies the given consumer to each direct supertype of the specified type.
      Parameters:
      type - the type whose supertypes are processed
      consumer - action applied to each supertype
    • firstSuperTypeMatching

      @CheckForNull public static Type firstSuperTypeMatching(Type type, Predicate<Type> predicate)
      Returns the first supertype of the given type that matches the predicate.
      Parameters:
      type - the type whose supertypes are inspected
      predicate - condition the supertype must satisfy
      Returns:
      the first matching supertype, or null
    • streamOfSuperTypes

      public static Stream<Type> streamOfSuperTypes(Type type)
      Returns a stream of all direct supertypes of the given type.
      Parameters:
      type - the type whose supertypes are requested
      Returns:
      stream of supertypes
    • getFirstNonImpliedGeneralType

      @CheckForNull public static Type getFirstNonImpliedGeneralType(Type type)
      Returns the first non‑implied general (super) type of the given type.
      Parameters:
      type - the type whose general type is requested
      Returns:
      the first non‑implied general type, or null
    • getSubTypesRecursively

      public static Collection<Type> getSubTypesRecursively(Type type, Class<? extends Specialization> specializationKind)
      Returns all subtypes of the given type recursively, excluding the type itself.
      Parameters:
      type - the type whose subtypes are requested
      specializationKind - the specialization class to filter by
      Returns:
      collection of recursive subtypes
    • getSubTypesRecursivelyIncludingSelf

      public static Collection<Type> getSubTypesRecursivelyIncludingSelf(Type type, Class<? extends Specialization> specializationKind)
      Returns all subtypes of the given type recursively, including the type itself.
      Parameters:
      type - the type whose subtypes are requested
      specializationKind - the specialization class to filter by
      Returns:
      collection of recursive subtypes including the type
    • getSuperTypes

      public static List<Type> getSuperTypes(Type type)
      Returns all direct supertypes of the given type as a list.
      Parameters:
      type - the type whose supertypes are requested
      Returns:
      list of supertypes