Package com.google.gson.internal
Class Primitives
- java.lang.Object
-
- com.google.gson.internal.Primitives
-
public final class Primitives extends Object
Contains static utility methods pertaining to primitive types and their corresponding wrapper types.- Author:
- Kevin Bourrillion
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isPrimitive(Type type)
Returns true if this type is a primitive.static boolean
isWrapperType(Type type)
static <T> Class<T>
unwrap(Class<T> type)
Returns the corresponding primitive type oftype
if it is a wrapper type; otherwise returnstype
itself.static <T> Class<T>
wrap(Class<T> type)
Returns the corresponding wrapper type oftype
if it is a primitive type; otherwise returnstype
itself.
-
-
-
Method Detail
-
isPrimitive
public static boolean isPrimitive(Type type)
Returns true if this type is a primitive.
-
isWrapperType
public static boolean isWrapperType(Type type)
- See Also:
Class.isPrimitive()
-
wrap
public static <T> Class<T> wrap(Class<T> type)
Returns the corresponding wrapper type oftype
if it is a primitive type; otherwise returnstype
itself. Idempotent.wrap(int.class) == Integer.class wrap(Integer.class) == Integer.class wrap(String.class) == String.class
-
-