MCPcopy
hub / github.com/google/gson / wrap

Method wrap

src/main/java/com/google/gson/Primitives.java:95–101  ·  view source on GitHub ↗

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

(Class<T> type)

Source from the content-addressed store, hash-verified

93 * </pre>
94 */
95 public static <T> Class<T> wrap(Class<T> type) {
96 // cast is safe: long.class and Long.class are both of type Class<Long>
97 @SuppressWarnings("unchecked")
98 Class<T> wrapped = (Class<T>) PRIMITIVE_TO_WRAPPER_TYPE.get(
99 $Gson$Preconditions.checkNotNull(type));
100 return (wrapped == null) ? type : wrapped;
101 }
102
103 /**
104 * Returns the corresponding primitive type of {@code type} if it is a

Callers 3

adaptTypeMethod · 0.95
getExpectedJsonMethod · 0.95
fromJsonMethod · 0.95

Calls 2

checkNotNullMethod · 0.80
getMethod · 0.45

Tested by 2

adaptTypeMethod · 0.76
getExpectedJsonMethod · 0.76