Package revxrsal.commands.util
Class Primitives
java.lang.Object
revxrsal.commands.util.Primitives
A utility class for dealing with wrapping and unwrapping of primitive
types
-
Method Summary
Modifier and TypeMethodDescriptionstatic Type
getInsideGeneric
(Type genericType, Type fallback) static Class<?>
getRawType
(Type type) static Class<?>
Returns the type of the given objectstatic boolean
isWrapperType
(Class<?> type) Returnstrue
if the specified type is one of the nine primitive-wrapper types, such asInteger
.static <T> Class<T>
Returns the corresponding primitive type oftype
if it is a wrapper type; otherwise returns the type itself.static <T> Class<T>
Returns the corresponding wrapper type oftype
if it is a primitive type; otherwise returns the type itself.static Type
-
Method Details
-
getType
Returns the type of the given object- Parameters:
o
- Object to get for- Returns:
- The object type
-
wrap
Returns the corresponding wrapper type oftype
if it is a primitive type; otherwise returns the type itself.wrap(int.class) == Integer.class wrap(Integer.class) == Integer.class wrap(String.class) == String.class
-
wrapType
-
unwrap
Returns the corresponding primitive type oftype
if it is a wrapper type; otherwise returns the type itself.unwrap(Integer.class) == int.class unwrap(int.class) == int.class unwrap(String.class) == String.class
-
isWrapperType
Returnstrue
if the specified type is one of the nine primitive-wrapper types, such asInteger
.- Parameters:
type
- Type to check- See Also:
-
getRawType
-
getInsideGeneric
-