public class ClassUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isAssignable(Class<?> cls,
Class<?> toClass)
Checks if one
cls can be assigned to a variable of
another toClass, like: Cls c = ...; ToClass x = c; |
static Class<?> |
primitiveToWrapper(Class<?> cls)
Converts the specified primitive Class object to its corresponding
wrapper Class object.
|
public static boolean isAssignable(Class<?> cls, Class<?> toClass)
cls can be assigned to a variable of
another toClass, like: Cls c = ...; ToClass x = c;cls - the Class to check, may be nulltoClass - the Class to try to assign into, returns false if nulltrue if assignment possiblepublic static Class<?> primitiveToWrapper(Class<?> cls)
Converts the specified primitive Class object to its corresponding wrapper Class object.
NOTE: From v2.2, this method handles Void.TYPE,
returning Void.TYPE.
cls - the class to convert, may be nullcls or cls if
cls is not a primitive. null if null input.Copyright © 2018–2021 SmallRye. All rights reserved.