Package com.google.gson.internal
Class Primitives
java.lang.Object
com.google.gson.internal.Primitives
Contains static utility methods pertaining to primitive types and their
corresponding wrapper types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isPrimitive
(Type type) Returns true if this type is a primitive.static boolean
isWrapperType
(Type type) static <T> Class
<T> Returns the corresponding primitive type oftype
if it is a wrapper type; otherwise returnstype
itself.static <T> Class
<T> Returns the corresponding wrapper type oftype
if it is a primitive type; otherwise returnstype
itself.
-
Constructor Details
-
Primitives
private Primitives()
-
-
Method Details
-
isPrimitive
Returns true if this type is a primitive. -
isWrapperType
- See Also:
-
wrap
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
-
unwrap
Returns the corresponding primitive type oftype
if it is a wrapper type; otherwise returnstype
itself. Idempotent.unwrap(Integer.class) == int.class unwrap(int.class) == int.class unwrap(String.class) == String.class
-