public abstract class ObjectGraph extends Object
The following injection features are supported:
@Inject-annotated constructor. Classes that have fields injected may omit the
@Injectannotation if they have a public no-arguments constructor.
The following injection features are not currently supported:
|Modifier and Type||Method and Description|
Returns a new dependency graph using the @
Returns an instance of
Injects the members of
Injects the static fields of the classes listed in the object graph's
Returns a new object graph that includes all of the objects in this graph, plus additional objects in the @
Do runtime graph problem detection.
public abstract <T> T get(Class<T> type)
public abstract <T> T inject(T instance)
instance, including injectable members inherited from its supertypes.
public abstract ObjectGraph plus(Object... modules)
Module-annotated modules. This graph is a subgraph of the returned graph.
The current graph is not modified by this operation: its objects and the dependency links between them are unchanged. But this graph's objects may be shared by both graphs. For example, the singletons of this graph may be injected and used by the returned graph.
This does not inject any members or validate the graph.
create(java.lang.Object...) for guidance on injection and validation.
public abstract void validate()
IllegalStateException- if this graph has problems.
public abstract void injectStatics()
public static ObjectGraph create(Object... modules)
This does not validate the graph. Rely on build time
tools for graph validation, or call
validate() to find problems in
the graph at runtime.
Copyright © 2014 Square, Inc.. All Rights Reserved.