Top Description Inners Fields Constructors Methods
com.google.inject.spi

public final Class InjectionPoint

extends Object
Class Inheritance
Static Imports
com.google.inject.internal.MoreTypes.getRawType

A constructor, field or method that can receive injections. Typically this is a member with the @Inject annotation. For non-private, no argument constructors, the member may omit the annotation.
Author
[email protected] (Bob Lee)
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv abstract static class
InjectionPoint.InjectableMember

Node in the doubly-linked list of injectable members (fields and methods).

pack-priv static class
InjectionPoint.InjectableMembers

Linked list of injectable members.

pack-priv static class
pack-priv static class
InjectionPoint.OverrideIndex

Keeps track of injectable methods so we can remove methods that get overridden in O(1) time.

pack-priv static enum
InjectionPoint.Position

Position in type hierarchy.

pack-priv static class
InjectionPoint.Signature

A method signature.

Field Summary

Modifier and TypeField and Description
private final TypeLiteral<?>
private final ImmutableList<Dependency<?>>
private static final Logger
private final Member
private final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
InjectionPoint(TypeLiteral<?> declaringType, Method method, boolean optional)

pack-priv
InjectionPoint(TypeLiteral<?> declaringType, Constructor<?> constructor)

pack-priv
InjectionPoint(TypeLiteral<?> declaringType, Field field, boolean optional)

Method Summary

Modifier and TypeMethod and Description
private static boolean
checkForMisplacedBindingAnnotations(Member member, Errors errors)

Returns true if the binding annotation is in the wrong place.

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static <T> InjectionPoint
forConstructor(Constructor<T>
any single constructor present on type.
constructor
)

Returns a new injection point for the specified constructor.

public static <T> InjectionPoint
forConstructor(Constructor<T>
any single constructor present on type.
constructor
,
TypeLiteral<? extends T>
the concrete type that defines constructor.
type
)

Returns a new injection point for the specified constructor of type.

public static InjectionPoint
forConstructorOf(TypeLiteral<?>
a concrete type with exactly one constructor annotated @Inject, or a no-arguments constructor that is not private.
type
)

Returns a new injection point for the injectable constructor of type.

public static InjectionPoint
forConstructorOf(TypeLiteral<?>
a concrete type with exactly one constructor annotated @Inject, or a no-arguments constructor that is not private.
type
,
boolean
whether the constructor must be annotated with Inject.
atInjectRequired
)

Returns a new injection point for the injectable constructor of type.

public static InjectionPoint
forConstructorOf(Class<?>
a concrete type with exactly one constructor annotated @Inject, or a no-arguments constructor that is not private.
type
)

Returns a new injection point for the injectable constructor of type.

public static Set<InjectionPoint>

Returns:

a possibly empty set of injection points. The set has a specified iteration order. All fields are returned and then all methods. Within the fields, supertype fields are returned before subtype fields. Similarly, supertype methods are returned before subtype methods.
forInstanceMethodsAndFields
(TypeLiteral<?> type)

Returns all instance method and field injection points on type.

public static Set<InjectionPoint>

Returns:

a possibly empty set of injection points. The set has a specified iteration order. All fields are returned and then all methods. Within the fields, supertype fields are returned before subtype fields. Similarly, supertype methods are returned before subtype methods.
forInstanceMethodsAndFields
(Class<?> type)

Returns all instance method and field injection points on type.

private ImmutableList<Dependency<?>>
forMember(Errors errors, Member member, TypeLiteral<?> type, AnnotatedType[] annotatedTypes, Annotation[][] parameterAnnotationsPerParameter, Predicate<Integer> isParameterKotlinNullable)

public static <T> InjectionPoint
forMethod(Method
any single method present on type.
method
,
TypeLiteral<T>
the concrete type that defines method.
type
)

Returns a new injection point for the specified method of type.

public static Set<InjectionPoint>

Returns:

a possibly empty set of injection points. The set has a specified iteration order. All fields are returned and then all methods. Within the fields, supertype fields are returned before subtype fields. Similarly, supertype methods are returned before subtype methods.
forStaticMethodsAndFields
(TypeLiteral<?> type)

Returns all static method and field injection points on type.

public static Set<InjectionPoint>

Returns:

a possibly empty set of injection points. The set has a specified iteration order. All fields are returned and then all methods. Within the fields, supertype fields are returned before subtype fields. Similarly, supertype methods are returned before subtype methods.
forStaticMethodsAndFields
(Class<?> type)

Returns all static method and field injection points on type.

public static Annotation[]
getAnnotations(Field field)

Returns all the annotations on a field.

pack-priv static Annotation
private static Field[]
private static Method[]
public TypeLiteral<?>
getDeclaringType()

Returns the generic type that defines this injection point.

public List<Dependency<?>>

Returns:

a possibly-empty list
getDependencies
()

Returns the dependencies for this injection point.

private static Set<InjectionPoint>
getInjectionPoints(final TypeLiteral<?> type, boolean
true is this method should return static members, false for instance members
statics
,
Errors
used to record errors
errors
)

Returns an ordered, immutable set of injection points for the given type.

public Member
getMember()

Returns the injected constructor, field, or method.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
private static List<TypeLiteral<?>>
private static boolean
isEligibleForInjection(Method method, boolean statics)

Returns true if the method is eligible to be injected.

private static boolean
public boolean
isOptional()

Returns true if this injection point shall be skipped if the injector cannot resolve bindings for all required dependencies.

public boolean
isToolable()

Returns true if the element is annotated with @Toolable.

private static boolean
private <T> Dependency<T>
newDependency(Key<T> key, boolean allowsNull, int parameterIndex)

private static boolean
overrides(Method a, Method b)

Returns true if a overrides b.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait