Class MoreTypes
- java.lang.Object
-
- org.elasticsearch.common.inject.internal.MoreTypes
-
public class MoreTypes extends java.lang.ObjectStatic methods for working with types that we aren't publishing in the publicTypesAPI.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMoreTypes.GenericArrayTypeImplstatic classMoreTypes.MemberImplWe cannot serialize the built-in Java member classes, which prevents us from using Members in our exception types.static classMoreTypes.ParameterizedTypeImplstatic classMoreTypes.WildcardTypeImplThe WildcardType interface supports multiple upper bounds and multiple lower bounds.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.reflect.Type[]EMPTY_TYPE_ARRAY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.reflect.Typecanonicalize(java.lang.reflect.Type type)Returns a type that is functionally equal but not necessarily equal according toObject.equals().static booleanequals(java.lang.reflect.Type a, java.lang.reflect.Type b)Returns true ifaandbare equal.static java.lang.reflect.TypegetGenericSupertype(java.lang.reflect.Type type, java.lang.Class<?> rawType, java.lang.Class<?> toResolve)Returns the generic supertype forsupertype.static java.lang.Class<?>getRawType(java.lang.reflect.Type type)static inthashCode(java.lang.reflect.Type type)Returns the hashCode oftype.static <T> TypeLiteral<T>makeKeySafe(TypeLiteral<T> type)Returns an equivalent type that's safe for use in a key.static java.lang.StringmemberKey(java.lang.reflect.Member member)static java.lang.Class<? extends java.lang.reflect.Member>memberType(java.lang.reflect.Member member)ReturnsField.class,Method.classorConstructor.class.static java.lang.reflect.TyperesolveTypeVariable(java.lang.reflect.Type type, java.lang.Class<?> rawType, java.lang.reflect.TypeVariable unknown)static java.lang.StringtoString(java.lang.reflect.Member member)Formats a member as concise string, such asjava.util.ArrayList.size,java.util.ArrayList<init>()orjava.util.List.remove().static java.lang.StringtoString(java.lang.reflect.Type type)
-
-
-
Method Detail
-
makeKeySafe
public static <T> TypeLiteral<T> makeKeySafe(TypeLiteral<T> type)
Returns an equivalent type that's safe for use in a key. The returned type will be free of primitive types. Type literals of primitives will return the corresponding wrapper types.- Throws:
ConfigurationException- iftypecontains a type variable
-
canonicalize
public static java.lang.reflect.Type canonicalize(java.lang.reflect.Type type)
Returns a type that is functionally equal but not necessarily equal according toObject.equals().
-
getRawType
public static java.lang.Class<?> getRawType(java.lang.reflect.Type type)
-
equals
public static boolean equals(java.lang.reflect.Type a, java.lang.reflect.Type b)Returns true ifaandbare equal.
-
hashCode
public static int hashCode(java.lang.reflect.Type type)
Returns the hashCode oftype.
-
toString
public static java.lang.String toString(java.lang.reflect.Type type)
-
memberType
public static java.lang.Class<? extends java.lang.reflect.Member> memberType(java.lang.reflect.Member member)
ReturnsField.class,Method.classorConstructor.class.
-
toString
public static java.lang.String toString(java.lang.reflect.Member member)
Formats a member as concise string, such asjava.util.ArrayList.size,java.util.ArrayList<init>()orjava.util.List.remove().
-
memberKey
public static java.lang.String memberKey(java.lang.reflect.Member member)
-
getGenericSupertype
public static java.lang.reflect.Type getGenericSupertype(java.lang.reflect.Type type, java.lang.Class<?> rawType, java.lang.Class<?> toResolve)Returns the generic supertype forsupertype. For example, given a classIntegerSet, the result for when supertype isSet.classisSet<Integer>and the result when the supertype isCollection.classisCollection<Integer>.
-
resolveTypeVariable
public static java.lang.reflect.Type resolveTypeVariable(java.lang.reflect.Type type, java.lang.Class<?> rawType, java.lang.reflect.TypeVariable unknown)
-
-