Types API.
| Modifier and Type | Class and Description |
|---|---|
| private static interface | MoreTypes.
A type formed from other types, such as arrays, parameterized types or wildcard types |
| public static class | |
| public static class | |
| public static class | MoreTypes.
The WildcardType interface supports multiple upper bounds and multiple lower bounds. |
| Modifier and Type | Field and Description |
|---|---|
| public static final Type[] | |
| private static final ImmutableMap |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Type | canonicalize(Type type)
Returns a type that is functionally equal but not necessarily equal according to |
| public static <T> TypeLiteral | |
| public static <T> Key | |
| private static void | |
| private static Class | declaringClassOf(TypeVariable<?> typeVariable)
Returns the declaring class of |
| public static boolean | |
| public static Type | getGenericSupertype(Type type, Class<?> rawType, Class<?> toResolve)
Returns the generic supertype for |
| public static Class | |
| private static Type[] | getSharedTypeArguments(ParameterizedType p)
This method is used as a performance optimization to prevent unnecessary clones of typeArguments from being made by ParameterizedTypeImpl. |
| private static int | |
| private static int | |
| private static boolean | |
| public static Type | |
| public static String |
| EMPTY_TYPE_ARRAY | back to summary |
|---|---|
| public static final Type[] EMPTY_TYPE_ARRAY | |
| PRIMITIVE_TO_WRAPPER | back to summary |
|---|---|
| private static final ImmutableMap<TypeLiteral<?>, TypeLiteral<?>> PRIMITIVE_TO_WRAPPER | |
| MoreTypes | back to summary |
|---|---|
| private MoreTypes() | |
| canonicalize | back to summary |
|---|---|
| public static Type canonicalize(Type type) Returns a type that is functionally equal but not necessarily equal according to | |
| canonicalizeForKey | back to summary |
|---|---|
| public static <T> TypeLiteral Returns an type that's appropriate for use in a key. If the raw type of If the type is a primitive, the corresponding wrapper type will be returned.
| |
| canonicalizeKey | back to summary |
|---|---|
| public static <T> Key Returns a key that doesn't hold any references to parent classes. This is necessary for anonymous keys, so ensure we don't hold a ref to the containing module (or class) forever. | |
| checkNotPrimitive | back to summary |
|---|---|
| private static void checkNotPrimitive(Type type, String use) | |
| declaringClassOf | back to summary |
|---|---|
| private static Class Returns the declaring class of | |
| equals | back to summary |
|---|---|
| public static boolean equals(Type a, Type b) Returns true if | |
| getGenericSupertype | back to summary |
|---|---|
| public static Type getGenericSupertype(Type type, Class<?> rawType, Class<?> toResolve) Returns the generic supertype for | |
| getRawType | back to summary |
|---|---|
| public static Class | |
| getSharedTypeArguments | back to summary |
|---|---|
| private static Type[] getSharedTypeArguments(ParameterizedType p) This method is used as a performance optimization to prevent unnecessary clones of typeArguments from being made by ParameterizedTypeImpl. | |
| hashCodeOrZero | back to summary |
|---|---|
| private static int hashCodeOrZero(Object o) | |
| indexOf | back to summary |
|---|---|
| private static int indexOf(Object[] array, Object toFind) | |
| isFullySpecified | back to summary |
|---|---|
| private static boolean isFullySpecified(Type type) Returns true if | |
| resolveTypeVariable | back to summary |
|---|---|
| public static Type resolveTypeVariable(Type type, Class<?> rawType, TypeVariable<?> unknown) | |
| typeToString | back to summary |
|---|---|
| public static String typeToString(Type type) | |
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| isFullySpecified | back to summary |
|---|---|
| public boolean isFullySpecified() Returns true if there are no type variables in this type. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Type | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| public Type | getGenericComponentType()
Implements java. Type object representing the component type
of this array.
|
| public int | |
| public boolean | isFullySpecified()
Implements com. |
| public String |
| componentType | back to summary |
|---|---|
| private final Type componentType | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| GenericArrayTypeImpl | back to summary |
|---|---|
| public GenericArrayTypeImpl(Type componentType) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getGenericComponentType | back to summary |
|---|---|
| public Type getGenericComponentType() Implements java. Doc from java. Returns a | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isFullySpecified | back to summary |
|---|---|
| public boolean isFullySpecified() Implements com. Doc from com. Returns true if there are no type variables in this type.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Type | |
| private final Type | |
| private static final long | |
| pack-priv final Type[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public Type[] | getActualTypeArguments()
Implements java. Type objects representing the actual type
arguments to this type.
|
| public Type | getOwnerType()
Implements java. Type object representing the type that this type
is a member of.
|
| public Type | getRawType()
Implements java. Type object representing the class or interface
that declared this type.
|
| public int | |
| public boolean | isFullySpecified()
Implements com. |
| public String |
| ownerType | back to summary |
|---|---|
| private final Type ownerType | |
| rawType | back to summary |
|---|---|
| private final Type rawType | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| typeArguments | back to summary |
|---|---|
| pack-priv final Type[] typeArguments | |
| ParameterizedTypeImpl | back to summary |
|---|---|
| public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) | |
| ensureOwnerType | back to summary |
|---|---|
| private static void ensureOwnerType(Type ownerType, Type rawType) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getActualTypeArguments | back to summary |
|---|---|
| public Type[] getActualTypeArguments() Implements java. Doc from java. Returns an array of Note that in some cases, the returned array be empty. This can occur if this type represents a non-parameterized type nested within a parameterized type. | |
| getOwnerType | back to summary |
|---|---|
| public Type getOwnerType() Implements java. Doc from java. Returns a If this type is a top-level type, | |
| getRawType | back to summary |
|---|---|
| public Type getRawType() Implements java. Doc from java. Returns the | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isFullySpecified | back to summary |
|---|---|
| public boolean isFullySpecified() Implements com. Doc from com. Returns true if there are no type variables in this type.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Type | |
| private static final long | |
| private final Type |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public Type[] | getLowerBounds()
Implements java. Type objects representing the
lower bound(s) of this type variable.
|
| public Type[] | getUpperBounds()
Implements java. Type objects representing the upper
bound(s) of this type variable.
|
| public int | |
| public boolean | isFullySpecified()
Implements com. |
| public String |
| lowerBound | back to summary |
|---|---|
| private final Type lowerBound | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| upperBound | back to summary |
|---|---|
| private final Type upperBound | |
| WildcardTypeImpl | back to summary |
|---|---|
| public WildcardTypeImpl(Type[] upperBounds, Type[] lowerBounds) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getLowerBounds | back to summary |
|---|---|
| public Type[] getLowerBounds() Implements java. Doc from java. Returns an array of For each lower bound B :
| |
| getUpperBounds | back to summary |
|---|---|
| public Type[] getUpperBounds() Implements java. Doc from java. Returns an array of For each upper bound B :
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isFullySpecified | back to summary |
|---|---|
| public boolean isFullySpecified() Implements com. Doc from com. Returns true if there are no type variables in this type.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |