Package com.google.common.reflect
Class Types
- java.lang.Object
-
- com.google.common.reflect.Types
-
final class Types extends java.lang.ObjectUtilities for working withType.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classTypes.ClassOwnershipDecides what owner type to use for constructingParameterizedTypefrom a raw class.private static classTypes.GenericArrayTypeImpl(package private) static classTypes.JavaVersion(package private) static classTypes.NativeTypeVariableEquals<X>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 classTypes.ParameterizedTypeImplprivate static classTypes.TypeVariableImpl<D extends java.lang.reflect.GenericDeclaration>private static classTypes.TypeVariableInvocationHandlerInvocation handler to work around a compatibility problem between Java 7 and Java 8.(package private) static classTypes.WildcardTypeImpl
-
Field Summary
Fields Modifier and Type Field Description private static JoinerCOMMA_JOINERprivate static Function<java.lang.reflect.Type,java.lang.String>TYPE_NAMEClass#toString without the "class " and "interface " prefixes
-
Constructor Summary
Constructors Modifier Constructor Description privateTypes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voiddisallowPrimitiveType(java.lang.reflect.Type[] types, java.lang.String usedAs)private static java.lang.Iterable<java.lang.reflect.Type>filterUpperBounds(java.lang.Iterable<java.lang.reflect.Type> bounds)(package private) static java.lang.Class<?>getArrayClass(java.lang.Class<?> componentType)Returns theClassobject of arrays withcomponentType.(package private) static java.lang.reflect.TypegetComponentType(java.lang.reflect.Type type)(package private) static java.lang.reflect.TypenewArrayType(java.lang.reflect.Type componentType)Returns the array type ofcomponentType.(package private) static <D extends java.lang.reflect.GenericDeclaration>
java.lang.reflect.TypeVariable<D>newArtificialTypeVariable(D declaration, java.lang.String name, java.lang.reflect.Type... bounds)Returns a newTypeVariablethat belongs todeclarationwithnameandbounds.(package private) static java.lang.reflect.ParameterizedTypenewParameterizedType(java.lang.Class<?> rawType, java.lang.reflect.Type... arguments)Returns a type whererawTypeis parameterized byarguments.(package private) static java.lang.reflect.ParameterizedTypenewParameterizedTypeWithOwner(java.lang.reflect.Type ownerType, java.lang.Class<?> rawType, java.lang.reflect.Type... arguments)Returns a type whererawTypeis parameterized byargumentsand is owned byownerType.private static <D extends java.lang.reflect.GenericDeclaration>
java.lang.reflect.TypeVariable<D>newTypeVariableImpl(D genericDeclaration, java.lang.String name, java.lang.reflect.Type[] bounds)(package private) static java.lang.reflect.WildcardTypesubtypeOf(java.lang.reflect.Type upperBound)Returns a newWildcardTypewithupperBound.private static java.lang.reflect.TypesubtypeOfComponentType(java.lang.reflect.Type[] bounds)Returns? extends Xif any ofboundsis a subtype ofX[]; or null otherwise.(package private) static java.lang.reflect.WildcardTypesupertypeOf(java.lang.reflect.Type lowerBound)Returns a newWildcardTypewithlowerBound.private static java.lang.reflect.Type[]toArray(java.util.Collection<java.lang.reflect.Type> types)(package private) static java.lang.StringtoString(java.lang.reflect.Type type)Returns human readable string representation oftype.
-
-
-
Method Detail
-
newArrayType
static java.lang.reflect.Type newArrayType(java.lang.reflect.Type componentType)
Returns the array type ofcomponentType.
-
newParameterizedTypeWithOwner
static java.lang.reflect.ParameterizedType newParameterizedTypeWithOwner(java.lang.reflect.Type ownerType, java.lang.Class<?> rawType, java.lang.reflect.Type... arguments)Returns a type whererawTypeis parameterized byargumentsand is owned byownerType.
-
newParameterizedType
static java.lang.reflect.ParameterizedType newParameterizedType(java.lang.Class<?> rawType, java.lang.reflect.Type... arguments)Returns a type whererawTypeis parameterized byarguments.
-
newArtificialTypeVariable
static <D extends java.lang.reflect.GenericDeclaration> java.lang.reflect.TypeVariable<D> newArtificialTypeVariable(D declaration, java.lang.String name, java.lang.reflect.Type... bounds)Returns a newTypeVariablethat belongs todeclarationwithnameandbounds.
-
subtypeOf
static java.lang.reflect.WildcardType subtypeOf(java.lang.reflect.Type upperBound)
Returns a newWildcardTypewithupperBound.
-
supertypeOf
static java.lang.reflect.WildcardType supertypeOf(java.lang.reflect.Type lowerBound)
Returns a newWildcardTypewithlowerBound.
-
toString
static java.lang.String toString(java.lang.reflect.Type type)
Returns human readable string representation oftype.The format is subject to change.
-
getComponentType
static java.lang.reflect.Type getComponentType(java.lang.reflect.Type type)
-
subtypeOfComponentType
private static java.lang.reflect.Type subtypeOfComponentType(java.lang.reflect.Type[] bounds)
Returns? extends Xif any ofboundsis a subtype ofX[]; or null otherwise.
-
newTypeVariableImpl
private static <D extends java.lang.reflect.GenericDeclaration> java.lang.reflect.TypeVariable<D> newTypeVariableImpl(D genericDeclaration, java.lang.String name, java.lang.reflect.Type[] bounds)
-
toArray
private static java.lang.reflect.Type[] toArray(java.util.Collection<java.lang.reflect.Type> types)
-
filterUpperBounds
private static java.lang.Iterable<java.lang.reflect.Type> filterUpperBounds(java.lang.Iterable<java.lang.reflect.Type> bounds)
-
disallowPrimitiveType
private static void disallowPrimitiveType(java.lang.reflect.Type[] types, java.lang.String usedAs)
-
getArrayClass
static java.lang.Class<?> getArrayClass(java.lang.Class<?> componentType)
Returns theClassobject of arrays withcomponentType.
-
-