Package | org.spicefactory.parsley.core.bootstrap.impl |
Class | public class DefaultService |
Inheritance | DefaultService Object |
Implements | Service |
Property | Defined By | ||
---|---|---|---|
factory : ServiceFactory [read-only]
The factory for the service implementation. | DefaultService | ||
serviceInterface : Class [read-only]
The interface all implementations of this service must implement. | DefaultService |
Method | Defined By | ||
---|---|---|---|
DefaultService(serviceInterface:Class)
Creates a new instance. | DefaultService | ||
addDecorator(type:Class, ... params):void
Adds a decorator for this service. | DefaultService | ||
Adds a parent service to be used to pull additional decorators and the default implementation from. | DefaultService | ||
getDecorators(status:LookupStatus = null):Array
All decorators added to this service. | DefaultService | ||
newInstance(initCallback:Function = null):Object
Creates a new instance of this service, using the specified implementation
and applying all decorators added to this service. | DefaultService | ||
setImplementation(type:Class, ... params):void
Sets the implementation for this service, replacing the existing registration. | DefaultService |
factory | property |
factory:ServiceFactory
[read-only] The factory for the service implementation. This factory produces an instance where the decorators added to this service have not yet been applied.
public function get factory():ServiceFactory
serviceInterface | property |
serviceInterface:Class
[read-only] The interface all implementations of this service must implement.
public function get serviceInterface():Class
DefaultService | () | Constructor |
public function DefaultService(serviceInterface:Class)
Creates a new instance.
ParametersserviceInterface:Class — the interface all implementations of this service must implement
|
addDecorator | () | method |
public function addDecorator(type:Class, ... params):void
Adds a decorator for this service. Decorating services is the recommended way of adding funcitonality to the kernel services, as it allows to stack multiple third party decorators without overriding each others extension. The decorator class must implement the same interface as the decorated service and come with a constructor that accepts the decorated service as the first parameter. If you pass additional parameters to this method they must be added as additional constructor parameters after this required first parameter.
Parameters
type:Class — the implementation type of the service
| |
... params — the parameters to pass to the constructor of the decorator, after the first parameter which is
always the decorated service itself
|
addParent | () | method |
public function addParent(parent:Service):void
Adds a parent service to be used to pull additional decorators and the default implementation from.
Parameters
parent:Service — a parent service to add to this service
|
getDecorators | () | method |
public function getDecorators(status:LookupStatus = null):Array
All decorators added to this service.
An Array of ServiceFactory
instances.
Parameters
status:LookupStatus (default = null ) — optional paramater to avoid duplicate lookups, for internal use only
|
Array — all decorators added to this service
|
newInstance | () | method |
public function newInstance(initCallback:Function = null):Object
Creates a new instance of this service, using the specified implementation and applying all decorators added to this service.
Parameters
initCallback:Function (default = null ) — the callback to invoke immediately after instantiation of service and decorator instances
|
Object — a new instance of this service
|
setImplementation | () | method |
public function setImplementation(type:Class, ... params):void
Sets the implementation for this service, replacing the existing registration.
Parameters
type:Class — the implementation type of the service
| |
... params — the parameters to pass to the constructor of the service
|