public class MoreTypes
extends java.lang.Object
Types
API.Modifier and Type | Class and Description |
---|---|
static class |
MoreTypes.GenericArrayTypeImpl |
static class |
MoreTypes.MemberImpl
We cannot serialize the built-in Java member classes, which prevents us from using Members in
our exception types.
|
static class |
MoreTypes.ParameterizedTypeImpl |
static class |
MoreTypes.WildcardTypeImpl
The WildcardType interface supports multiple upper bounds and multiple
lower bounds.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.reflect.Type[] |
EMPTY_TYPE_ARRAY |
Modifier and Type | Method and Description |
---|---|
static java.lang.reflect.Type |
canonicalize(java.lang.reflect.Type type)
Returns a type that is functionally equal but not necessarily equal
according to
Object.equals() . |
static boolean |
equals(java.lang.reflect.Type a,
java.lang.reflect.Type b)
Returns true if
a and b are equal. |
static java.lang.reflect.Type |
getGenericSupertype(java.lang.reflect.Type type,
java.lang.Class<?> rawType,
java.lang.Class<?> toResolve)
Returns the generic supertype for
supertype . |
static java.lang.Class<?> |
getRawType(java.lang.reflect.Type type) |
static int |
hashCode(java.lang.reflect.Type type)
Returns the hashCode of
type . |
static <T> TypeLiteral<T> |
makeKeySafe(TypeLiteral<T> type)
Returns an equivalent type that's safe for use in a key.
|
static java.lang.String |
memberKey(java.lang.reflect.Member member) |
static java.lang.Class<? extends java.lang.reflect.Member> |
memberType(java.lang.reflect.Member member)
Returns
Field.class , Method.class or Constructor.class . |
static java.lang.reflect.Type |
resolveTypeVariable(java.lang.reflect.Type type,
java.lang.Class<?> rawType,
java.lang.reflect.TypeVariable unknown) |
static java.lang.String |
toString(java.lang.reflect.Member member)
Formats a member as concise string, such as
java.util.ArrayList.size ,
java.util.ArrayList<init>() or java.util.List.remove() . |
static java.lang.String |
toString(java.lang.reflect.Type type) |
public static <T> TypeLiteral<T> makeKeySafe(TypeLiteral<T> type)
ConfigurationException
- if type
contains a type variablepublic static java.lang.reflect.Type canonicalize(java.lang.reflect.Type type)
Object.equals()
.public static java.lang.Class<?> getRawType(java.lang.reflect.Type type)
public static boolean equals(java.lang.reflect.Type a, java.lang.reflect.Type b)
a
and b
are equal.public static int hashCode(java.lang.reflect.Type type)
type
.public static java.lang.String toString(java.lang.reflect.Type type)
public static java.lang.Class<? extends java.lang.reflect.Member> memberType(java.lang.reflect.Member member)
Field.class
, Method.class
or Constructor.class
.public static java.lang.String toString(java.lang.reflect.Member member)
java.util.ArrayList.size
,
java.util.ArrayList<init>()
or java.util.List.remove()
.public static java.lang.String memberKey(java.lang.reflect.Member member)
public static java.lang.reflect.Type getGenericSupertype(java.lang.reflect.Type type, java.lang.Class<?> rawType, java.lang.Class<?> toResolve)
supertype
. For example, given a class IntegerSet
, the result for when supertype is Set.class
is Set<Integer>
and the
result when the supertype is Collection.class
is Collection<Integer>
.public static java.lang.reflect.Type resolveTypeVariable(java.lang.reflect.Type type, java.lang.Class<?> rawType, java.lang.reflect.TypeVariable unknown)