Class ClassUtils
java.lang.Object
org.assertj.core.util.introspection.ClassUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAllInterfaces(Class<?> cls) Gets aListof all interfaces implemented by the given class and its superclasses.getAllSuperclasses(Class<?> cls) Gets aListof superclasses for the given class.static booleanisInJavaLangPackage(Class<?> type) Returns whether the giventypebelongs to the java.lang package itself or one of its subpackage.static booleanisOptionalOrPrimitiveOptional(Class<?> type) Returns whether the giventypeis a primitive or primitive wrapper (Optional,OptionalInt,OptionalLong,OptionalDouble).static booleanisPrimitiveOrWrapper(Class<?> type)
-
Constructor Details
-
ClassUtils
public ClassUtils()
-
-
Method Details
-
getAllSuperclasses
Gets a
Listof superclasses for the given class.- Parameters:
cls- the class to look up, may benull- Returns:
- the
Listof superclasses in order going up from this onenullif null input
-
getAllInterfaces
Gets a
Listof all interfaces implemented by the given class and its superclasses.The order is determined by looking through each interface in turn as declared in the source file and following its hierarchy up. Then each superclass is considered in the same way. Later duplicates are ignored, so the order is maintained.
- Parameters:
cls- the class to look up, may benull- Returns:
- the
Listof interfaces in order,nullif null input
-
isPrimitiveOrWrapper
-
isOptionalOrPrimitiveOptional
Returns whether the giventypeis a primitive or primitive wrapper (Optional,OptionalInt,OptionalLong,OptionalDouble).Returns false if passed null since the method can't evaluate the class.
- Parameters:
type- The class to query or null.- Returns:
- true if the given
typeis a primitive or primitive wrapper (Optional,OptionalInt,OptionalLong,OptionalDouble). - Since:
- 3.24.0
-
isInJavaLangPackage
Returns whether the giventypebelongs to the java.lang package itself or one of its subpackage.- Parameters:
type- The class to check or null.- Returns:
- true the given
typebelongs to the java.lang package itself or one of its subpackage, false otherwise. - Since:
- 3.25.0
-