Package com.google.common.reflect
Class Types
java.lang.Object
com.google.common.reflect.Types
Utilities for working with
Type
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enum
Decides what owner type to use for constructingParameterizedType
from a raw class.private static final class
(package private) static enum
(package private) static final class
Per issue 1635, In JDK 1.7.0_51-b13,Types.TypeVariableImpl.equals(Object)
is changed to no longer be equal to custom TypeVariable implementations.private static final class
private static final class
Types.TypeVariableImpl<D extends GenericDeclaration>
private static final class
Invocation handler to work around a compatibility problem between Java 7 and Java 8.(package private) static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Joiner
Class#toString without the "class " and "interface " prefixes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
disallowPrimitiveType
(Type[] types, String usedAs) filterUpperBounds
(Iterable<Type> bounds) (package private) static Class
<?> getArrayClass
(Class<?> componentType) Returns theClass
object of arrays withcomponentType
.(package private) static Type
getComponentType
(Type type) (package private) static Type
newArrayType
(Type componentType) Returns the array type ofcomponentType
.(package private) static <D extends GenericDeclaration>
TypeVariable<D> newArtificialTypeVariable
(D declaration, String name, Type... bounds) (package private) static ParameterizedType
newParameterizedType
(Class<?> rawType, Type... arguments) Returns a type whererawType
is parameterized byarguments
.(package private) static ParameterizedType
newParameterizedTypeWithOwner
(Type ownerType, Class<?> rawType, Type... arguments) Returns a type whererawType
is parameterized byarguments
and is owned byownerType
.private static <D extends GenericDeclaration>
TypeVariable<D> newTypeVariableImpl
(D genericDeclaration, String name, Type[] bounds) (package private) static WildcardType
Returns a newWildcardType
withupperBound
.private static Type
subtypeOfComponentType
(Type[] bounds) Returns? extends X
if any ofbounds
is a subtype ofX[]
; or null otherwise.(package private) static WildcardType
supertypeOf
(Type lowerBound) Returns a newWildcardType
withlowerBound
.private static Type[]
toArray
(Collection<Type> types) (package private) static String
Returns a human-readable string representation oftype
.
-
Field Details
-
COMMA_JOINER
Class#toString without the "class " and "interface " prefixes
-
-
Constructor Details
-
Types
private Types()
-
-
Method Details
-
newArrayType
Returns the array type ofcomponentType
. -
newParameterizedTypeWithOwner
static ParameterizedType newParameterizedTypeWithOwner(@CheckForNull Type ownerType, Class<?> rawType, Type... arguments) Returns a type whererawType
is parameterized byarguments
and is owned byownerType
. -
newParameterizedType
Returns a type whererawType
is parameterized byarguments
. -
newArtificialTypeVariable
static <D extends GenericDeclaration> TypeVariable<D> newArtificialTypeVariable(D declaration, String name, Type... bounds) -
subtypeOf
Returns a newWildcardType
withupperBound
. -
supertypeOf
Returns a newWildcardType
withlowerBound
. -
toString
Returns a human-readable string representation oftype
.The format is subject to change.
-
getComponentType
-
subtypeOfComponentType
Returns? extends X
if any ofbounds
is a subtype ofX[]
; or null otherwise. -
newTypeVariableImpl
private static <D extends GenericDeclaration> TypeVariable<D> newTypeVariableImpl(D genericDeclaration, String name, Type[] bounds) -
toArray
-
filterUpperBounds
-
disallowPrimitiveType
-
getArrayClass
Returns theClass
object of arrays withcomponentType
.
-