org.apache.tapestry5.ioc.def
Interface ServiceDef

All Known Subinterfaces:
ServiceDef2, ServiceDef3
All Known Implementing Classes:
ServiceDefImpl, SpringBeanServiceDef

public interface ServiceDef

Service definition derived, by default, from a service builder method. This has been extended in Tapestry 5.1 with ServiceDef2, which adds additional methods.


Method Summary
 ObjectCreator createServiceCreator(ServiceBuilderResources resources)
          Returns an ObjectCreator that can create the core service implementation.
 Set<Class> getMarkers()
          Returns an optional set of marker annotations.
 String getServiceId()
          Returns the service id, derived from the method name or the unqualified service interface name.
 Class getServiceInterface()
          Returns the service interface associated with this service.
 String getServiceScope()
          Returns the lifecycle defined for the service.
 boolean isEagerLoad()
          Returns true if the service should be eagerly loaded at Registry startup.
 

Method Detail

createServiceCreator

ObjectCreator createServiceCreator(ServiceBuilderResources resources)
Returns an ObjectCreator that can create the core service implementation.

Parameters:
resources - used to resolve dependencies of the service, or access its configuration
Returns:
an object that can (later) be used to instantiate the service itself

getServiceId

String getServiceId()
Returns the service id, derived from the method name or the unqualified service interface name. Service ids must be unique among all services in all modules. Service ids are used in a heavy handed way to support ultimate disambiguation, but their primary purpose is to support service contribution methods.


getMarkers

Set<Class> getMarkers()
Returns an optional set of marker annotations. Marker annotations are used to disambiguate services; the combination of a marker annotation and a service type is expected to be unique. The annotation is placed on the field or method/constructor parameter and the service is located by combining the marker with service type (the parameter or field type).

Returns:
the marker annotations for the service (possibly empty), including any default marker annotations from the containing module.

getServiceInterface

Class getServiceInterface()
Returns the service interface associated with this service. This is the interface exposed to the outside world, as well as the one used to build proxies. In cases where the service is not defined in terms of an interface, this will return the actual implementation class of the service. Services without a true service interface are not proxied, which has a number of ramifications (such as losing lazy instantiation capabilities and other more interesting lifecycles).


getServiceScope

String getServiceScope()
Returns the lifecycle defined for the service. This is indicated by adding a Scope annotation to the service builder method for the service.

Services that are not proxied will ignore their scope; such services are always treated as singletons.

See Also:
ServiceLifecycle, ServiceLifecycleSource

isEagerLoad

boolean isEagerLoad()
Returns true if the service should be eagerly loaded at Registry startup.

See Also:
EagerLoad


Copyright © 2003-2012 The Apache Software Foundation.