public final class Keys extends Object
com.square.Foo: provides instances of Foo.
@com.square.Bar/com.square.Foo: provides instances of Foo
qualified by the annotation.
members/com.square.Foo: injects members of Foo.
@Provides methods are of the first two types. BindingsGroup
created from @Inject-annotated members of a class are of the first
and last types.| Modifier and Type | Method and Description |
|---|---|
static String |
get(Type type)
Returns a key for
type with no annotation. |
static String |
get(Type type,
Annotation[] annotations,
Object subject)
Returns a key for
type annotated with annotations,
reporting failures against subject. |
static String |
getClassName(String key)
Returns the class name for
key, if key was created with a
class instance. |
static String |
getMembersKey(Class<?> key)
Returns a key for the members of
type. |
static String |
getSetKey(Type type,
Annotation[] annotations,
Object subject)
Returns a key for
type annotated with annotations,
wrapped by Set, reporting failures against subject. |
static boolean |
isAnnotated(String key)
Returns true if
key has a qualifier annotation. |
static boolean |
isPlatformType(String name)
Returns true if
name is the name of a platform-provided class. |
public static String getMembersKey(Class<?> key)
type.public static String getSetKey(Type type, Annotation[] annotations, Object subject)
type annotated with annotations,
wrapped by Set, reporting failures against subject.annotations - the annotations on a single method, field or parameter.
This array may contain at most one qualifier annotation.public static String get(Type type, Annotation[] annotations, Object subject)
type annotated with annotations,
reporting failures against subject.annotations - the annotations on a single method, field or parameter.
This array may contain at most one qualifier annotation.public static boolean isAnnotated(String key)
key has a qualifier annotation.public static String getClassName(String key)
key, if key was created with a
class instance. Returns null if key represents a parameterized type
or an array type.public static boolean isPlatformType(String name)
name is the name of a platform-provided class.Copyright © 2024 Square, Inc.. All rights reserved.