Packageorg.spicefactory.parsley.view
Classpublic class FastInject
InheritanceFastInject Inheritance Object

Provides a fluent API for injecting a managed object from the nearest Context in the view hierarchy into a view without reflecting on the view. This API can be used in ActionScript components (Flex or Flash) as an alternative to the <FastInject> MXML tag for MXML components.



Public Methods
 MethodDefined By
  
autoremove(value:Boolean):FastInject
Indicates whether the injected object should be removed from the Context when the view is removed from the stage and the injected object is a DynamicObject.
FastInject
  
complete(callback:Function):FastInject
A callback to invoke when the injection has been completed.
FastInject
  
execute():void
Triggers the (potentially asynchronous) injection.
FastInject
  
The instance that controls the lifecycle of the view.
FastInject
  
objectId(objectId:String):FastInject
The id the object to inject is configured with in the Parsley Context.
FastInject
  
property(property:String):FastInject
The name of the property of the target to inject into.
FastInject
  
reuse(value:Boolean):FastInject
Indicates whether the target instance will be reused in subsequent lifecycles of the view.
FastInject
  
target(target:Object):FastInject
The target to inject into.
FastInject
  
type(type:Class):FastInject
The type of the object to inject from the nearest Parsley Context.
FastInject
  
view(view:DisplayObject):FastInject
[static] The view that demarcates the lifecycle of the target instance to inject into.
FastInject
Method Detail
autoremove()method
public function autoremove(value:Boolean):FastInject

Indicates whether the injected object should be removed from the Context when the view is removed from the stage and the injected object is a DynamicObject. Only has an effect when no custom ViewLifecycle has been set.

Parameters

value:Boolean — Indicates whether the injected object should be removed from the Context when the view is removed from the stage and the injected object is a DynamicObject

Returns
FastInject — this FastInject instance for method chaining
complete()method 
public function complete(callback:Function):FastInject

A callback to invoke when the injection has been completed.

Parameters

callback:Function — a callback to invoke when the injection has been completed

Returns
FastInject — this FastInject instance for method chaining
execute()method 
public function execute():void

Triggers the (potentially asynchronous) injection.

lifecycle()method 
public function lifecycle(lifecycle:ViewLifecycle):FastInject

The instance that controls the lifecycle of the view. This property may be null, in this case the default lifecycle installed in the Context for the type of view of this configuration will be used.

Parameters

lifecycle:ViewLifecycle — the instance that controls the lifecycle of the view

Returns
FastInject — this FastInject instance for method chaining
objectId()method 
public function objectId(objectId:String):FastInject

The id the object to inject is configured with in the Parsley Context. FastInject can do either injection by type or by id. Thus either this method or type must be called.

Parameters

objectId:String — the id the object to inject is configured with in the Parsley Context

Returns
FastInject — this FastInject instance for method chaining
property()method 
public function property(property:String):FastInject

The name of the property of the target to inject into.

Parameters

property:String — name of the property of the target to inject into

Returns
FastInject — this FastInject instance for method chaining
reuse()method 
public function reuse(value:Boolean):FastInject

Indicates whether the target instance will be reused in subsequent lifecycles of the view. When set to false the injection will only be processed once. This value should be true if the application keeps instances of the view in memory and adds them back to the stage later. It should be false if the view will get garbage collected once it has been removed from the stage.

Parameters

value:Boolean — indicates whether the target instance will be reused in subsequent lifecycles of the view

Returns
FastInject — this FastInject instance for method chaining
target()method 
public function target(target:Object):FastInject

The target to inject into.

Parameters

target:Object — the target to get processed by the nearest Context in the view hierarchy

Returns
FastInject — this FastInject instance for method chaining
type()method 
public function type(type:Class):FastInject

The type of the object to inject from the nearest Parsley Context. FastInject can do either injection by type or by id. Thus either this method or objectId must be called.

Parameters

type:Class — the type of the object to inject from the nearest Parsley Context

Returns
FastInject — this FastInject instance for method chaining
view()method 
public static function view(view:DisplayObject):FastInject

The view that demarcates the lifecycle of the target instance to inject into. The view may be the same instance as the target itself or a different one that just controls the lifecycle. A typical example for the two properties pointing to different instances would be the target being a presentation model that should get added to the Context for the time the view it belongs to is on the stage.

Parameters

view:DisplayObject — the view that demarcates the lifecycle of the target instance

Returns
FastInject — a new Configure instance for further setup options