java.lang.Object
dev.mccue.guava.primitives.Primitives
Contains static utility methods pertaining to primitive types and their corresponding wrapper
types.
- Since:
- 1.0
- Author:
- Kevin Bourrillion
-
Method Summary
Modifier and TypeMethodDescriptionReturns an immutable set of all nine primitive types (includingvoid).Returns an immutable set of all nine primitive-wrapper types (includingVoid).static booleanisWrapperType(Class<?> type) static <T> Class<T>Returns the corresponding primitive type oftypeif it is a wrapper type; otherwise returnstypeitself.static <T> Class<T>Returns the corresponding wrapper type oftypeif it is a primitive type; otherwise returnstypeitself.
-
Method Details
-
allPrimitiveTypes
Returns an immutable set of all nine primitive types (includingvoid). Note that a simpler way to test whether aClassinstance is a member of this set is to callClass.isPrimitive().- Since:
- 3.0
-
allWrapperTypes
Returns an immutable set of all nine primitive-wrapper types (includingVoid).- Since:
- 3.0
-
isWrapperType
- See Also:
-
wrap
Returns the corresponding wrapper type oftypeif it is a primitive type; otherwise returnstypeitself. Idempotent.wrap(int.class) == Integer.class wrap(Integer.class) == Integer.class wrap(String.class) == String.class -
unwrap
Returns the corresponding primitive type oftypeif it is a wrapper type; otherwise returnstypeitself. Idempotent.unwrap(Integer.class) == int.class unwrap(int.class) == int.class unwrap(String.class) == String.class
-