Top Description Constructors Methods
com.google.gson.internal

public final Class Primitives

extends Object
Class Inheritance
Imports
java.lang.reflect.Type

Contains static utility methods pertaining to primitive types and their corresponding wrapper types.
Author
Kevin Bourrillion

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean
isPrimitive(Type type)

Returns true if this type is a primitive.

public static boolean
isWrapperType(Type type)

Returns true if type is one of the nine primitive-wrapper types, such as Integer.

public static <T> Class<T>
unwrap(Class<T> type)

Returns the corresponding primitive type of type if it is a wrapper type; otherwise returns type itself.

public static <T> Class<T>
wrap(Class<T> type)

Returns the corresponding wrapper type of type if it is a primitive type; otherwise returns type itself.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Primitivesback to summary
private Primitives()

Method Detail

isPrimitiveback to summary
public static boolean isPrimitive(Type type)

Returns true if this type is a primitive.

isWrapperTypeback to summary
public static boolean isWrapperType(Type type)

Returns true if type is one of the nine primitive-wrapper types, such as Integer.

See Also
Class#isPrimitive
unwrapback to summary
public static <T> Class<T> unwrap(Class<T> type)

Returns the corresponding primitive type of type if it is a wrapper type; otherwise returns type itself. Idempotent.

    unwrap(Integer.class) == int.class
    unwrap(int.class) == int.class
    unwrap(String.class) == String.class
Annotations
@SuppressWarnings:unchecked, MissingBraces
wrapback to summary
public static <T> Class<T> wrap(Class<T> type)

Returns the corresponding wrapper type of type if it is a primitive type; otherwise returns type itself. Idempotent.

    wrap(int.class) == Integer.class
    wrap(Integer.class) == Integer.class
    wrap(String.class) == String.class
Annotations
@SuppressWarnings:unchecked, MissingBraces