Class ClassUtils
java.lang.Object
org.assertj.core.util.introspection.ClassUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAllInterfaces(Class<?> cls) Gets aListof all interfaces implemented by the given class and its superclasses.(package private) static voidgetAllInterfaces(Class<?> cls, HashSet<Class<?>> interfacesFound) Get the interfaces for the specified class.getAllSuperclasses(Class<?> cls) Gets aListof superclasses for the given class.static booleanisOptionalOrPrimitiveOptional(Class<?> type) Returns whether the giventypeis a primitive or primitive wrapper (Optional,OptionalInt,OptionalLong,OptionalDouble).static booleanisPrimitiveOrWrapper(Class<?> type)
-
Field Details
-
PRIMITIVE_WRAPPER_TYPES
Lists primitive wrapperClasses. -
OPTIONAL_TYPES
-
-
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
-
getAllInterfaces
Get the interfaces for the specified class.- Parameters:
cls- the class to look up, may benullinterfacesFound- theSetof interfaces for the class
-
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
-