Packageorg.spicefactory.parsley.context
Classpublic class ServiceBuilder
InheritanceServiceBuilder Inheritance Object

Builder for specifying replacements or decorators for the core kernel services.



Public Methods
 MethodDefined By
  
addDecorator(type:Class, ... params):ContextBuilderSetup
Adds a decorator for this service.
ServiceBuilder
  
setImplementation(type:Class, ... params):ContextBuilderSetup
Sets the implementation for this service, replacing the existing registration.
ServiceBuilder
Method Detail
addDecorator()method
public function addDecorator(type:Class, ... params):ContextBuilderSetup

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

Returns
ContextBuilderSetup — the original setup instance for method chaining
setImplementation()method 
public function setImplementation(type:Class, ... params):ContextBuilderSetup

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

Returns
ContextBuilderSetup — the original setup instance for method chaining