public class RegistryWrapper extends Object implements Registry
InternalRegistry
that exists to expand symbols in a service id before
invoking ObjectLocator.getService(String, Class)
.Constructor and Description |
---|
RegistryWrapper(InternalRegistry registry) |
Modifier and Type | Method and Description |
---|---|
<T> T |
autobuild(Class<T> clazz)
Autobuilds a class by finding the public constructor with the most parameters.
|
<T> T |
autobuild(String description,
Class<T> clazz)
Preferred version of
ObjectLocator.autobuild(Class) that tracks the operation using
OperationTracker.invoke(String, org.apache.tapestry5.ioc.Invokable) . |
void |
cleanupThread()
Invoked at the end of a request to discard any thread-specific information accumulated during the current
request.
|
<T> T |
getObject(Class<T> objectType,
AnnotationProvider annotationProvider)
Obtains an object indirectly, using the
MasterObjectProvider service. |
<T> T |
getService(Class<T> serviceInterface)
Locates a service given a service interface and (optionally) some marker annotation types.
|
<T> T |
getService(Class<T> serviceInterface,
Class<? extends Annotation>... markerTypes)
Locates a service given a service interface and (optionally) some marker annotation types.
|
<T> T |
getService(String serviceId,
Class<T> serviceInterface)
Obtains a service via its unique service id.
|
void |
performRegistryStartup()
Invoked to eagerly load services marked with the
EagerLoad annotation, and to execute all contributions
to the Startup service. |
<T> T |
proxy(Class<T> interfaceClass,
Class<? extends T> implementationClass)
Creates a proxy.
|
void |
shutdown()
Shuts down a Registry instance.
|
public RegistryWrapper(InternalRegistry registry)
public void cleanupThread()
Registry
cleanupThread
in interface Registry
PerthreadManager
,
ThreadCleanupListener
public void shutdown()
Registry
shutdown
in interface Registry
RegistryShutdownHub
,
RegistryShutdownListener
public <T> T getObject(Class<T> objectType, AnnotationProvider annotationProvider)
ObjectLocator
MasterObjectProvider
service.getObject
in interface ObjectLocator
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
public <T> T getService(String serviceId, Class<T> serviceInterface)
ObjectLocator
getService
in interface ObjectLocator
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)public <T> T getService(Class<T> serviceInterface)
ObjectLocator
getService
in interface ObjectLocator
serviceInterface
- the interface the service implementsMarker
public <T> T getService(Class<T> serviceInterface, Class<? extends Annotation>... markerTypes)
ObjectLocator
getService
in interface ObjectLocator
serviceInterface
- the interface the service implementsmarkerTypes
- Markers used to select a specific service that implements the interfaceMarker
public <T> T autobuild(Class<T> clazz)
ObjectLocator
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 the MasterObjectProvider service.autobuild
in interface ObjectLocator
clazz
- the type of object to instantiatepublic <T> T autobuild(String description, Class<T> clazz)
ObjectLocator
ObjectLocator.autobuild(Class)
that tracks the operation using
OperationTracker.invoke(String, org.apache.tapestry5.ioc.Invokable)
.autobuild
in interface ObjectLocator
description
- description used with OperationTracker
clazz
- the type of object to instantiatepublic void performRegistryStartup()
Registry
EagerLoad
annotation, and to execute all contributions
to the Startup service.performRegistryStartup
in interface Registry
public <T> T proxy(Class<T> interfaceClass, Class<? extends T> implementationClass)
ObjectLocator
ObjectLocator.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).proxy
in interface ObjectLocator
interfaceClass
- the interface implemented by the proxyimplementationClass
- a concrete class that implements the interfaceObjectLocator.autobuild(Class)
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.