Class Specializations
java.lang.Object
com.dassault_systemes.modeler.kerml.model.Specializations
Utility class to work with
Specialization and Type-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TypefirstSuperTypeMatching(Type type, Predicate<Type> predicate) Returns the first supertype of the given type that matches the predicate.static <T extends Type>
TfirstSuperTypeMatching(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.static voidforEachSuperType(Type type, Consumer<Type> consumer) Applies the given consumer to each direct supertype of the specified type.static TypeReturns the first non‑implied general (super) type of the given type.static Collection<Type> getSubTypesRecursively(Type type, Class<? extends Specialization> specializationKind) Returns all subtypes of the given type recursively, excluding the type itself.static Collection<Type> getSubTypesRecursivelyIncludingSelf(Type type, Class<? extends Specialization> specializationKind) Returns all subtypes of the given type recursively, including the type itself.getSuperTypes(Type type) Returns all direct supertypes of the given type as a list.streamOfSubTypes(Type type, Class<? extends Specialization> specializationKind) Returns a stream of subtypes of the given type using the specified specialization kind.streamOfSuperTypes(Type type) Returns a stream of all direct supertypes of the given 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 requestedspecializationKind- 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 inspectedpredicate- condition the supertype must satisfytypeClass- class the supertype must be an instance of- Returns:
- the first matching supertype, or null
-
forEachSuperType
Applies the given consumer to each direct supertype of the specified type.- Parameters:
type- the type whose supertypes are processedconsumer- action applied to each supertype
-
firstSuperTypeMatching
Returns the first supertype of the given type that matches the predicate.- Parameters:
type- the type whose supertypes are inspectedpredicate- condition the supertype must satisfy- Returns:
- the first matching supertype, or null
-
streamOfSuperTypes
Returns a stream of all direct supertypes of the given type.- Parameters:
type- the type whose supertypes are requested- Returns:
- stream of supertypes
-
getFirstNonImpliedGeneralType
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 requestedspecializationKind- 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 requestedspecializationKind- the specialization class to filter by- Returns:
- collection of recursive subtypes including the type
-
getSuperTypes
Returns all direct supertypes of the given type as a list.- Parameters:
type- the type whose supertypes are requested- Returns:
- list of supertypes
-