public class SingletonServiceLifecycle extends Object implements ServiceLifecycle2
ObjectCreator
to create an instance of the service when asked.Constructor and Description |
---|
SingletonServiceLifecycle() |
Modifier and Type | Method and Description |
---|---|
Object |
createService(ServiceResources resources,
ObjectCreator creator)
Returns the same creator, or a new one, that encapsulates the creation of the core service implementation.
|
boolean |
isSingleton()
Returns true if the lifecycle is a singleton (a service that will only be created once).
|
boolean |
requiresProxy()
If true, then lifecycle requires a proxy, meaning it is only usable with services that properly define a service
interface.
|
public SingletonServiceLifecycle()
public Object createService(ServiceResources resources, ObjectCreator creator)
ServiceLifecycle
createService
in interface ServiceLifecycle
resources
- source of information about the service to be created, and source of additional services or
other resources that may be needed when constructing the core service implementationcreator
- object capable of creating the service implementation on demand. This is a wrapper around the
service's builder method.public boolean isSingleton()
ServiceLifecycle
ScopeConstants.PERTHREAD
scope}. A future version of Tapestry IoC may optimize for the
later case.isSingleton
in interface ServiceLifecycle
public boolean requiresProxy()
ServiceLifecycle2
ServiceLifecycle
as a ServiceLifecycle2
is to return true.requiresProxy
in interface ServiceLifecycle2
5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.