Class TypeUtil
- java.lang.Object
-
- org.apache.logging.log4j.core.util.TypeUtil
-
public final class TypeUtil extends Object
Utility class for working with JavaType
s and derivatives. This class is adapted heavily from the Spring Framework, specifically the TypeUtils class.- Since:
- 2.1
- See Also:
Type
,GenericArrayType
,ParameterizedType
,WildcardType
,Class
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Field>
getAllDeclaredFields(Class<?> cls)
Gets all declared fields for the given class (including superclasses).static boolean
isAssignable(Type lhs, Type rhs)
Indicates if twoType
s are assignment compatible.
-
-
-
Method Detail
-
getAllDeclaredFields
public static List<Field> getAllDeclaredFields(Class<?> cls)
Gets all declared fields for the given class (including superclasses).- Parameters:
cls
- the class to examine- Returns:
- all declared fields for the given class (including superclasses).
- See Also:
Class.getDeclaredFields()
-
isAssignable
public static boolean isAssignable(Type lhs, Type rhs)
Indicates if twoType
s are assignment compatible.- Parameters:
lhs
- the left hand side to check assignability torhs
- the right hand side to check assignability from- Returns:
true
if it is legal to assign a variable of typerhs
to a variable of typelhs
- See Also:
Class.isAssignableFrom(Class)
-
-