|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectLocator
Defines an object which can provide access to services defined within a Registry
, or
to objects or object instances available by other means. Services are accessed via service id, or
(when appropriate)
by just service interface. The Registry itself implements this interface, as does
ServiceResources
.
Method Summary | ||
---|---|---|
|
autobuild(Class<T> clazz)
Autobuilds a class by finding the public constructor with the most parameters. |
|
|
autobuild(String description,
Class<T> clazz)
Preferred version of autobuild(Class) that tracks the operation using
OperationTracker.invoke(String, Invokable) . |
|
|
getObject(Class<T> objectType,
AnnotationProvider annotationProvider)
Obtains an object indirectly, using the MasterObjectProvider service. |
|
|
getService(Class<T> serviceInterface)
Locates a service given a service interface and (optionally) some marker annotation types. |
|
|
getService(Class<T> serviceInterface,
Class<? extends Annotation>... markerTypes)
Locates a service given a service interface and (optionally) some marker annotation types. |
|
|
getService(String serviceId,
Class<T> serviceInterface)
Obtains a service via its unique service id. |
|
|
proxy(Class<T> interfaceClass,
Class<? extends T> implementationClass)
Creates a proxy. |
Method Detail |
---|
<T> T getService(String serviceId, Class<T> serviceInterface)
T
- serviceId
- unique Service id used to locate the service object (may contain symbols,
which
will be expanded), case is ignoredserviceInterface
- the interface implemented by the service (or an interface extended by the service
interface)
RuntimeException
- if the service is not defined, or if an error occurs instantiating it<T> T getService(Class<T> serviceInterface)
serviceInterface
- the interface the service implements
RuntimeException
- if the service does not exist (this is considered programmer error), or multiple
services directly implement, or extend from, the service interfaceMarker
<T> T getService(Class<T> serviceInterface, Class<? extends Annotation>... markerTypes)
serviceInterface
- the interface the service implementsmarkerTypes
- Markers used to select a specific service that implements the interface
RuntimeException
- if the service does not exist (this is considered programmer error), or multiple
services directly implement, or extend from, the service interfaceMarker
<T> T getObject(Class<T> objectType, AnnotationProvider annotationProvider)
MasterObjectProvider
service.
T
- objectType
- the type of object to be returnedannotationProvider
- provides access to annotations on the field or parameter for which a value is to
be
obtained, which may be utilized in selecting an appropriate object, use
null when annotations are not available (in which case, selection
will
be based only on the object type)
ObjectProvider
<T> T autobuild(Class<T> clazz)
Inject
annotation. There are two cases: constructing a service implementation, and constructing
an arbitrary object. In the former case, many service resources are also available for injection, not
just dependencies or objects provided via
MasterObjectProvider.provide(Class, AnnotationProvider, ObjectLocator, boolean)
.
T
- clazz
- the type of object to instantiate
RuntimeException
- if the autobuild failsMasterObjectProvider
<T> T autobuild(String description, Class<T> clazz)
autobuild(Class)
that tracks the operation using
OperationTracker.invoke(String, Invokable)
.
T
- description
- description used with OperationTracker
clazz
- the type of object to instantiate
RuntimeException
- if the autobuild failsMasterObjectProvider
<T> T proxy(Class<T> interfaceClass, Class<? extends T> implementationClass)
autobuild(Class)
until
just-in-time (that is, first method invocation). In a limited number of cases, it is necessary to use such a
proxy to prevent service construction cycles, particularly when contributing (directly or indirectly) to the
MasterObjectProvider
(which is itself at the heart
of autobuilding).
If the class file for the class is a file on the file system (not a file packaged in a JAR), then the proxy will
autoreload: changing the class file will result in the new class being reloaded and re-instantiated
(with dependencies).
T
- interfaceClass
- the interface implemented by the proxyimplementationClass
- a concrete class that implements the interface
autobuild(Class)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |