public final class TypeArguments
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static interface |
TypeArguments.Implicit
Qualifier of bindings that should be treated as implicit. |
| Modifier and Type | Field and Description |
|---|---|
private static com.google.inject.TypeLiteral<?>[] |
NO_TYPE_LITERALS |
private static com.google.inject.TypeLiteral<java.lang.Object> |
OBJECT_TYPE_LITERAL |
| Modifier | Constructor and Description |
|---|---|
private |
TypeArguments() |
| Modifier and Type | Method and Description |
|---|---|
private static com.google.inject.TypeLiteral<?> |
expand(java.lang.reflect.Type type)
Expands wild-card types where possible, for example
Bar from ? extends Bar. |
static com.google.inject.TypeLiteral<?>[] |
get(com.google.inject.TypeLiteral<?> typeLiteral)
Get all type arguments from a generic type, for example
[Foo,Bar] from Map<Foo,Bar>. |
static com.google.inject.TypeLiteral<?> |
get(com.google.inject.TypeLiteral<?> typeLiteral,
int index)
Get an indexed type argument from a generic type, for example
Bar from Map<Foo,Bar>. |
static <T> com.google.inject.Key<T> |
implicitKey(java.lang.Class<T> clazz)
Creates a special binding key for the given implicit type.
|
private static boolean |
isAssignableFrom(java.lang.reflect.Type[] superArgs,
java.lang.reflect.Type[] subArgs)
Determines whether the resolved sub-type arguments can be assigned to their generic super-type arguments.
|
static boolean |
isAssignableFrom(com.google.inject.TypeLiteral<?> superLiteral,
com.google.inject.TypeLiteral<?> subLiteral)
Determines if the sub-type can be converted to the generic super-type via an identity or widening conversion.
|
static boolean |
isConcrete(java.lang.Class<?> clazz)
Determines if the given raw type represents a concrete type.
|
static boolean |
isConcrete(com.google.inject.TypeLiteral<?> literal)
Determines if the given generic type represents a concrete type.
|
static boolean |
isImplicit(java.lang.Class<?> clazz)
Determines if the given raw type represents an implicit binding.
|
static boolean |
isImplicit(com.google.inject.TypeLiteral<?> literal)
Determines if the given generic type represents an implicit binding.
|
private static final com.google.inject.TypeLiteral<java.lang.Object> OBJECT_TYPE_LITERAL
private static final com.google.inject.TypeLiteral<?>[] NO_TYPE_LITERALS
public static com.google.inject.TypeLiteral<?>[] get(com.google.inject.TypeLiteral<?> typeLiteral)
[Foo,Bar] from Map<Foo,Bar>.typeLiteral - The generic typepublic static com.google.inject.TypeLiteral<?> get(com.google.inject.TypeLiteral<?> typeLiteral,
int index)
Bar from Map<Foo,Bar>.typeLiteral - The generic typeindex - The argument indexTypeLiteral<Object> if the given type is a raw classpublic static boolean isAssignableFrom(com.google.inject.TypeLiteral<?> superLiteral,
com.google.inject.TypeLiteral<?> subLiteral)
superLiteral - The generic super-typesubLiteral - The generic sub-typetrue if the sub-type can be converted to the generic super-type; otherwise falseClass.isAssignableFrom(Class)public static boolean isConcrete(com.google.inject.TypeLiteral<?> literal)
literal - The generic typetrue if the generic type is concrete; otherwise falsepublic static boolean isConcrete(java.lang.Class<?> clazz)
clazz - The raw typetrue if the raw type is concrete; otherwise falsepublic static boolean isImplicit(com.google.inject.TypeLiteral<?> literal)
literal - The generic typetrue if the generic type is implicit; otherwise falsepublic static boolean isImplicit(java.lang.Class<?> clazz)
clazz - The raw typetrue if the raw type is implicit; otherwise falsepublic static <T> com.google.inject.Key<T> implicitKey(java.lang.Class<T> clazz)
clazz - The implicit typeprivate static com.google.inject.TypeLiteral<?> expand(java.lang.reflect.Type type)
Bar from ? extends Bar.type - The generic typeprivate static boolean isAssignableFrom(java.lang.reflect.Type[] superArgs,
java.lang.reflect.Type[] subArgs)
superArgs - The generic super-argumentssubArgs - The resolved sub-argumentstrue if all the super-arguments have assignable resolved arguments; otherwise false