Class ClassUtils
java.lang.Object
org.assertj.core.util.introspection.ClassUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAllInterfaces
(Class<?> cls) Gets aList
of all interfaces implemented by the given class and its superclasses.getAllSuperclasses
(Class<?> cls) Gets aList
of superclasses for the given class.static boolean
isInJavaLangPackage
(Class<?> type) Returns whether the giventype
belongs to the java.lang package itself or one of its subpackage.static boolean
isOptionalOrPrimitiveOptional
(Class<?> type) Returns whether the giventype
is a primitive or primitive wrapper (Optional
,OptionalInt
,OptionalLong
,OptionalDouble
).static boolean
isPrimitiveOrWrapper
(Class<?> type)
-
Constructor Details
-
ClassUtils
public ClassUtils()
-
-
Method Details
-
getAllSuperclasses
Gets a
List
of superclasses for the given class.- Parameters:
cls
- the class to look up, may benull
- Returns:
- the
List
of superclasses in order going up from this onenull
if null input
-
getAllInterfaces
Gets a
List
of 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
List
of interfaces in order,null
if null input
-
isPrimitiveOrWrapper
-
isOptionalOrPrimitiveOptional
Returns whether the giventype
is 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
type
is a primitive or primitive wrapper (Optional
,OptionalInt
,OptionalLong
,OptionalDouble
). - Since:
- 3.24.0
-
isInJavaLangPackage
Returns whether the giventype
belongs to the java.lang package itself or one of its subpackage.- Parameters:
type
- The class to check or null.- Returns:
- true the given
type
belongs to the java.lang package itself or one of its subpackage, false otherwise. - Since:
- 3.25.0
-