Uses of Class
com.google.common.reflect.TypeToken
Packages that use TypeToken
Package
Description
Utilities for reflection.
Testing utilities.
-
Uses of TypeToken in com.google.common.reflect
Subclasses of TypeToken in com.google.common.reflectFields in com.google.common.reflect declared as TypeTokenFields in com.google.common.reflect with type parameters of type TypeTokenModifier and TypeFieldDescriptionMutableTypeToInstanceMap.backingMap
private ImmutableSet
<TypeToken<? super T>> TypeToken.ClassSet.classes
private final ImmutableMap
<TypeToken<? extends B>, B> ImmutableTypeToInstanceMap.delegate
(package private) static final TypeToken.TypeCollector
<TypeToken<?>> TypeToken.TypeCollector.FOR_GENERIC_TYPE
private ImmutableSet
<TypeToken<? super T>> TypeToken.InterfaceSet.interfaces
private final ImmutableMap.Builder
<TypeToken<? extends B>, B> ImmutableTypeToInstanceMap.Builder.mapBuilder
private ImmutableSet
<TypeToken<? super T>> TypeToken.TypeSet.types
Methods in com.google.common.reflect that return TypeTokenModifier and TypeMethodDescriptionTypeToken.boundAsSuperclass
(Type bound) TypeToken.getArraySubtype
(Class<?> subclass) TypeToken.getArraySupertype
(Class<? super T> supertype) final TypeToken
<?> TypeToken.getComponentType()
Returns the array component type if this type represents an array (int[]
,T[]
,<? extends Map<String, Integer>[]>
etc.), or elsenull
is returned.TypeToken.getGenericSuperclass()
Returns the generic superclass of this type ornull
if the type representsObject
or an interface.Invokable.getOwnerType()
Returns the type ofT
.Invokable.getReturnType()
Returns the return type of thisInvokable
.TypeToken.getSubtype
(Class<?> subclass) Returns subtype ofthis
withsubclass
as the raw class.TypeToken.getSubtypeFromLowerBounds
(Class<?> subclass, Type[] lowerBounds) TypeToken.getSupertype
(Class<? super T> superclass) Returns the generic form ofsuperclass
.TypeToken.getSupertypeFromUpperBounds
(Class<? super T> supertype, Type[] upperBounds) TypeToken
<?> Parameter.getType()
Returns the type of the parameter.static <T> TypeToken
<T> Returns an instance of type token that wrapstype
.static TypeToken
<?> Returns an instance of type token that wrapstype
.TypeToken.rejectTypeVariables()
Ensures that this type token doesn't contain type variables, which can cause unchecked type errors for callers likeTypeToInstanceMap
.private TypeToken
<?> TypeToken.resolveSupertype
(Type type) final TypeToken
<?> TypeToken.resolveType
(Type type) Resolves the giventype
against the type context represented by this type.(package private) static <T> TypeToken
<? extends T> TypeToken.toGenericType
(Class<T> cls) Returns the type token representing the generic type declaration ofcls
.TypeToken.unwrap()
Returns the corresponding primitive type if this is a wrapper type; otherwise returnsthis
itself.TypeToken.where
(TypeParameter<X> typeParam, TypeToken<X> typeArg) Returns a newTypeToken
where type variables represented bytypeParam
are substituted bytypeArg
.TypeToken.where
(TypeParameter<X> typeParam, Class<X> typeArg) Returns a newTypeToken
where type variables represented bytypeParam
are substituted bytypeArg
.TypeToken.wrap()
Returns the corresponding wrapper type if this is a primitive type; otherwise returnsthis
itself.Methods in com.google.common.reflect that return types with arguments of type TypeTokenModifier and TypeMethodDescriptionprivate ImmutableList
<TypeToken<? super T>> TypeToken.boundsAsInterfaces
(Type[] bounds) ImmutableTypeToInstanceMap.delegate()
MutableTypeToInstanceMap.delegate()
TypeToken.ClassSet.delegate()
TypeToken.InterfaceSet.delegate()
TypeToken.TypeSet.delegate()
MutableTypeToInstanceMap.entrySet()
final ImmutableList
<TypeToken<? extends Throwable>> Invokable.getExceptionTypes()
Returns all declared exception types of thisInvokable
.(package private) final ImmutableList
<TypeToken<? super T>> TypeToken.getGenericInterfaces()
Returns the generic interfaces that this type directlyimplements
.Methods in com.google.common.reflect with parameters of type TypeTokenModifier and TypeMethodDescription<T extends B>
TImmutableTypeToInstanceMap.getInstance
(TypeToken<T> type) <T extends B>
TMutableTypeToInstanceMap.getInstance
(TypeToken<T> type) <T extends B>
TTypeToInstanceMap.getInstance
(TypeToken<T> type) Returns the value the specified type is mapped to, ornull
if no entry for this type is present.final boolean
TypeToken.isSubtypeOf
(TypeToken<?> type) Returns true if this type is a subtype of the giventype
.final boolean
TypeToken.isSupertypeOf
(TypeToken<?> type) Returns true if this type is a supertype of the giventype
.<T extends B>
ImmutableTypeToInstanceMap.Builder<B> Associateskey
withvalue
in the built map.Deprecated.unsupported operationDeprecated.unsupported operation<T extends B>
TImmutableTypeToInstanceMap.putInstance
(TypeToken<T> type, T value) Deprecated.unsupported operation<T extends B>
TMutableTypeToInstanceMap.putInstance
(TypeToken<T> type, T value) <T extends B>
TTypeToInstanceMap.putInstance
(TypeToken<T> type, T value) Maps the specified type to the specified value.Explicitly specifies the return type of thisInvokable
.private <T extends B>
TImmutableTypeToInstanceMap.trustedGet
(TypeToken<T> type) private <T extends B>
TMutableTypeToInstanceMap.trustedGet
(TypeToken<T> type) private <T extends B>
TMutableTypeToInstanceMap.trustedPut
(TypeToken<T> type, T value) TypeToken.where
(TypeParameter<X> typeParam, TypeToken<X> typeArg) Returns a newTypeToken
where type variables represented bytypeParam
are substituted bytypeArg
.Method parameters in com.google.common.reflect with type arguments of type TypeTokenModifier and TypeMethodDescriptionvoid
Deprecated.unsupported operationvoid
Deprecated.unsupported operationConstructors in com.google.common.reflect with parameters of type TypeTokenModifierConstructorDescription(package private)
Parameter
(Invokable<?, ?> declaration, int position, TypeToken<?> type, Annotation[] annotations, Object annotatedType) Constructor parameters in com.google.common.reflect with type arguments of type TypeTokenModifierConstructorDescriptionprivate
ImmutableTypeToInstanceMap
(ImmutableMap<TypeToken<? extends B>, B> delegate) -
Uses of TypeToken in com.google.common.testing
Fields in com.google.common.testing declared as TypeTokenModifier and TypeFieldDescriptionprivate final TypeToken
<?> DummyProxy.DummyHandler.interfaceType
Methods in com.google.common.testing that return TypeTokenModifier and TypeMethodDescription(package private) TypeToken
<?> FreshValueGenerator.generateTypeToken()
private static TypeToken
<?> NullPointerTester.getFirstTypeParameter
(Type type) Methods in com.google.common.testing with parameters of type TypeTokenModifier and TypeMethodDescriptionprivate <F,
T> Converter <F, T> NullPointerTester.defaultConverter
(TypeToken<F> convertFromType, TypeToken<T> convertToType) (package private) <R> R
ClassSanityTester.SerializableDummyProxy.dummyReturnValue
(TypeToken<R> returnType) (package private) abstract <R> R
DummyProxy.dummyReturnValue
(TypeToken<R> returnType) Returns the dummy return value forreturnType
.private Object
Generates an instance fortype
using the currentFreshValueGenerator.freshness
.(package private) final Object
FreshValueGenerator.generateFresh
(TypeToken<?> type) Returns a fresh instance fortype
if possible.private <T> T
NullPointerTester.getDefaultValue
(TypeToken<T> type) private <T> T
ClassSanityTester.getDummyValue
(TypeToken<T> type) private static <T> ImmutableList
<Invokable<?, ? extends T>> ClassSanityTester.getFactories
(TypeToken<T> type) Factories with the least number of parameters are listed first.private <T> T
NullPointerTester.newDefaultReturningProxy
(TypeToken<T> type) (package private) final <T> T
Returns a new proxy forinterfaceType
.Constructors in com.google.common.testing with parameters of type TypeToken