Packageorg.spicefactory.parsley.core.bootstrap.impl
Classpublic class ServiceFactory
InheritanceServiceFactory Inheritance Object

A simple factory for creating service instances. It allows to register the implementation class, optionally the interface the service must implement and parameters to pass to the constructor.



Public Properties
 PropertyDefined By
  implementation : Class
[read-only] The class that implements the service.
ServiceFactory
Public Methods
 MethodDefined By
  
ServiceFactory(implementation:Class, params:Array = null, requiredInterface:Class = null)
Creates a new instance.
ServiceFactory
  
newInstance(... params):Object
Creates a new instance of the service.
ServiceFactory
Property Detail
implementationproperty
implementation:Class  [read-only]

The class that implements the service.


Implementation
    public function get implementation():Class
Constructor Detail
ServiceFactory()Constructor
public function ServiceFactory(implementation:Class, params:Array = null, requiredInterface:Class = null)

Creates a new instance.

Parameters
implementation:Class — the class that implements the service
 
params:Array (default = null) — the parameters to pass to the constructor of the service
 
requiredInterface:Class (default = null) — the interface the service implementation must implement
Method Detail
newInstance()method
public function newInstance(... params):Object

Creates a new instance of the service.

Parameters

... params — additional parameters to pass to the constructor of the service, prepended to the ones specified when creating this factory.

Returns
Object