Class ClassUtils
- java.lang.Object
-
- io.smallrye.reactive.messaging.helpers.ClassUtils
-
public class ClassUtils extends Object
Allows checking if a class can be assigned to a variable from another class. Code extracted from from Apache Commons Lang 3 - ClassUtils.java
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisAssignable(Class<?> cls, Class<?> toClass)Checks if oneclscan be assigned to a variable of anothertoClass, like:Cls c = ...; ToClass x = c;static Class<?>primitiveToWrapper(Class<?> cls)Converts the specified primitive Class object to its corresponding wrapper Class object.
-
-
-
Method Detail
-
isAssignable
public static boolean isAssignable(Class<?> cls, Class<?> toClass)
Checks if oneclscan be assigned to a variable of anothertoClass, like:Cls c = ...; ToClass x = c;- Parameters:
cls- the Class to check, may benulltoClass- the Class to try to assign into, returnsfalseif null- Returns:
trueif assignment possible
-
primitiveToWrapper
public 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, returningVoid.TYPE.- Parameters:
cls- the class to convert, may be null- Returns:
- the wrapper class for
clsorclsifclsis not a primitive.nullif null input. - Since:
- 2.1
-
-