org.apache.tapestry5.ioc
public interface: ObjectLocator [javadoc |
source]
All Known Implementing Classes:
ObjectLocatorImpl, RegistryImpl, ServiceResourcesImpl, InternalRegistry, ServiceBuilderResources, ServiceResources, RegistryWrapper, IOCInternalTestCase, Registry
Defines an object which can provide access to services defined within a
org.apache.tapestry5.ioc.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
org.apache.tapestry5.ioc.ServiceResources .
Method from org.apache.tapestry5.ioc.ObjectLocator Detail: |
public T autobuild(Class<T> clazz)
Autobuilds a class by finding the public constructor with the most parameters. Services and resources will be
injected into the parameters of the constructor. |
public T getObject(Class<T> objectType,
AnnotationProvider annotationProvider)
|
public T getService(Class<T> serviceInterface)
Locates a service given just a service interface. A single service must implement the service interface (which
can be hard to guarantee). The search takes into account inheritance of the service interface (not the service
implementation), which may result in a failure due to extra matches. |
public T getService(String serviceId,
Class<T> serviceInterface)
Obtains a service via its unique service id. Returns the service's proxy. The service proxy implements the same
interface as the actual service, and is used to instantiate the actual service only as needed (this is
transparent to the application). |
public T proxy(Class<T> interfaceClass,
Class<? extends T> implementationClass)
Creates a proxy. The proxy will defer invocation of #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 org.apache.tapestry5.ioc.services.MasterObjectProvider (which is itself at the heart of autobuilding). |