org.apache.tapestry5.ioc.internal
Class ServiceResourcesImpl

java.lang.Object
  extended by org.apache.tapestry5.ioc.internal.ObjectLocatorImpl
      extended by org.apache.tapestry5.ioc.internal.ServiceResourcesImpl
All Implemented Interfaces:
AnnotationAccess, ModuleBuilderSource, ObjectLocator, ServiceBuilderResources, ServiceResources

public class ServiceResourcesImpl
extends ObjectLocatorImpl
implements ServiceBuilderResources

Implementation of ServiceBuilderResources. We just have one implementation that fills the purposes of methods that need a ServiceResources (which includes service decorator methods) as well as methods that need a ServiceBuilderResources (which is just service builder methods). Since it is most commonly used for the former, we'll just leave the name as ServiceResourcesImpl.


Constructor Summary
ServiceResourcesImpl(InternalRegistry registry, Module module, ServiceDef3 serviceDef, PlasticProxyFactory proxyFactory, org.slf4j.Logger logger)
           
 
Method Summary
<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, Invokable).
 AnnotationProvider getClassAnnotationProvider()
          Returns a provider for annotations on the service class and interface.
 Class getImplementationClass()
          Returns null (as of 5.3).
 org.slf4j.Logger getLogger()
          Returns a Logger appropriate for logging messages.
<K,V> Map<K,V>
getMappedConfiguration(Class<K> keyType, Class<V> valueType)
           
 AnnotationProvider getMethodAnnotationProvider(String methodName, Class... parameterTypes)
          Returns a provider for annotations of a method of the class.
 Object getModuleBuilder()
          Returns the instantiated version of the Tapestry IoC module class.
<T> List<T>
getOrderedConfiguration(Class<T> valueType)
           
 String getServiceId()
          Returns the fully qualified id of the service.
 Class getServiceInterface()
          Returns the service interface implemented by the service.
 OperationTracker getTracker()
          Returns an object that can be used to track operations related to constructing, configuring, decorating and initializing the service.
<T> Collection<T>
getUnorderedConfiguration(Class<T> valueType)
           
 
Methods inherited from class org.apache.tapestry5.ioc.internal.ObjectLocatorImpl
getObject, getService, getService, getService, proxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry5.ioc.ObjectLocator
getObject, getService, getService, getService, proxy
 

Constructor Detail

ServiceResourcesImpl

public ServiceResourcesImpl(InternalRegistry registry,
                            Module module,
                            ServiceDef3 serviceDef,
                            PlasticProxyFactory proxyFactory,
                            org.slf4j.Logger logger)
Method Detail

getServiceId

public String getServiceId()
Description copied from interface: ServiceResources
Returns the fully qualified id of the service.

Specified by:
getServiceId in interface ServiceResources

getServiceInterface

public Class getServiceInterface()
Description copied from interface: ServiceResources
Returns the service interface implemented by the service.

Specified by:
getServiceInterface in interface ServiceResources

getLogger

public org.slf4j.Logger getLogger()
Description copied from interface: ServiceResources
Returns a Logger appropriate for logging messages. This includes debug level messages about the creation and configuration of the underlying service, as well as debug, warning, or error level messages from the service itself. Often service interceptors will make use of the service's logger.

Specified by:
getLogger in interface ServiceResources

getUnorderedConfiguration

public <T> Collection<T> getUnorderedConfiguration(Class<T> valueType)
Specified by:
getUnorderedConfiguration in interface ServiceBuilderResources

getOrderedConfiguration

public <T> List<T> getOrderedConfiguration(Class<T> valueType)
Specified by:
getOrderedConfiguration in interface ServiceBuilderResources

getMappedConfiguration

public <K,V> Map<K,V> getMappedConfiguration(Class<K> keyType,
                                             Class<V> valueType)
Specified by:
getMappedConfiguration in interface ServiceBuilderResources

getModuleBuilder

public Object getModuleBuilder()
Description copied from interface: ModuleBuilderSource
Returns the instantiated version of the Tapestry IoC module class.

Specified by:
getModuleBuilder in interface ModuleBuilderSource

autobuild

public <T> T autobuild(String description,
                       Class<T> clazz)
Description copied from interface: ObjectLocator
Preferred version of ObjectLocator.autobuild(Class) that tracks the operation using OperationTracker.invoke(String, Invokable).

Specified by:
autobuild in interface ObjectLocator
Overrides:
autobuild in class ObjectLocatorImpl
Parameters:
description - description used with OperationTracker
clazz - the type of object to instantiate
Returns:
the instantiated instance
See Also:
MasterObjectProvider

autobuild

public <T> T autobuild(Class<T> clazz)
Description copied from interface: ObjectLocator
Autobuilds a class by finding the public constructor with the most parameters. Services and other resources or dependencies will be injected into the parameters of the constructor and into private fields marked with the 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).

Specified by:
autobuild in interface ObjectLocator
Overrides:
autobuild in class ObjectLocatorImpl
Parameters:
clazz - the type of object to instantiate
Returns:
the instantiated instance
See Also:
MasterObjectProvider

getTracker

public OperationTracker getTracker()
Description copied from interface: ServiceResources
Returns an object that can be used to track operations related to constructing, configuring, decorating and initializing the service.

Specified by:
getTracker in interface ServiceResources

getImplementationClass

public Class getImplementationClass()
Description copied from interface: ServiceResources
Returns null (as of 5.3).

Specified by:
getImplementationClass in interface ServiceResources

getClassAnnotationProvider

public AnnotationProvider getClassAnnotationProvider()
Description copied from interface: AnnotationAccess
Returns a provider for annotations on the service class and interface. This will reflect annotations defined by the implementation class itself, plus annotations defined by the service interface (implementation class annotations take precedence).

Specified by:
getClassAnnotationProvider in interface AnnotationAccess

getMethodAnnotationProvider

public AnnotationProvider getMethodAnnotationProvider(String methodName,
                                                      Class... parameterTypes)
Description copied from interface: AnnotationAccess
Returns a provider for annotations of a method of the class. This includes annotations on the implementation method, plus annotations on the corresponding service interface method (if such a method exists), with precedence on the implementation class method annotations.

Specified by:
getMethodAnnotationProvider in interface AnnotationAccess


Copyright © 2003-2012 The Apache Software Foundation.