public abstract class Types
extends java.lang.Object
| Constructor and Description |
|---|
Types() |
| Modifier and Type | Method and Description |
|---|---|
static com.google.common.reflect.TypeToken<?> |
getArrayItemType(com.google.common.reflect.TypeToken<?> type)
Gets the element type of a type we want to treat as an array.
|
static java.lang.String |
getSimpleName(com.google.common.reflect.TypeToken<?> type,
ApiSerializationConfig config)
Gets a simple name for a type that's suitable for use as a schema name.
|
static com.google.common.reflect.TypeToken<?> |
getTypeParameter(com.google.common.reflect.TypeToken<?> type,
int index)
Returns the type parameter at a specified index.
|
static boolean |
isArrayType(com.google.common.reflect.TypeToken<?> type)
Returns whether or not this type should be treated as a JSON array type.
|
static boolean |
isCollectionResponseType(com.google.common.reflect.TypeToken<?> type) |
static boolean |
isEnumType(com.google.common.reflect.TypeToken<?> type)
Returns whether or not this type is an
Enum. |
static boolean |
isJavaClientEntity(com.google.common.reflect.TypeToken<?> type)
Returns whether or not this type is a Google Java client library entity.
|
static boolean |
isMapType(com.google.common.reflect.TypeToken<?> type)
Returns whether or not this type is a
Map. |
static boolean |
isObject(com.google.common.reflect.TypeToken<?> type)
Returns whether or not this type is
Object, excluding subtypes. |
static boolean |
isTypeVariable(com.google.common.reflect.TypeToken<?> type)
Returns whether or not this type is an unresolved type variable.
|
static boolean |
isWildcardType(com.google.common.reflect.TypeToken<?> type) |
public static boolean isArrayType(com.google.common.reflect.TypeToken<?> type)
Collection types, except for byte arrays, which are treated as base64
encoded strings.public static boolean isEnumType(com.google.common.reflect.TypeToken<?> type)
Enum.public static boolean isMapType(com.google.common.reflect.TypeToken<?> type)
Map. This excludes GenericData, which is
used by the Google Java client library as a supertype of resource types with concrete fields.public static boolean isJavaClientEntity(com.google.common.reflect.TypeToken<?> type)
public static boolean isTypeVariable(com.google.common.reflect.TypeToken<?> type)
public static boolean isCollectionResponseType(com.google.common.reflect.TypeToken<?> type)
public static boolean isWildcardType(com.google.common.reflect.TypeToken<?> type)
public static boolean isObject(com.google.common.reflect.TypeToken<?> type)
Object, excluding subtypes.public static java.lang.String getSimpleName(com.google.common.reflect.TypeToken<?> type,
ApiSerializationConfig config)
public static com.google.common.reflect.TypeToken<?> getArrayItemType(com.google.common.reflect.TypeToken<?> type)
Collection can be treated as arrays. Returns null if the type cannot be
treated as an array.public static com.google.common.reflect.TypeToken<?> getTypeParameter(com.google.common.reflect.TypeToken<?> type,
int index)
java.lang.IllegalArgumentException - if the type is not parameterizedjava.lang.IndexOutOfBoundsException - if the type doesn't have enough type parameters