box.system.ioc.config.concurrent.Callable interface">
ColdBox Platform Version 3.0.0

coldbox.system.ioc.config
Class Binder

WEB-INF.cftags.component
        extended by coldbox.system.ioc.config.Binder
Direct Known Subclasses:
DefaultBinder

public class Binder
extends WEB-INF.cftags.component

This is a WireBox configuration binder object. You can use it to configure a WireBox injector instance using our WireBox Mapping DSL


Constructor Summary
init(any<Injector> injector, [any config], [any<struct> properties='[runtime expression]'])
          Constructor: You can pass a data CFC instance, data CFC path or nothing at all for purely programmatic configuration
 
Method Summary
 any asEagerInit()
          If this method is called, the mapped object will be created once the injector starts up
 any asSingleton()
          Map as a singleton, shortcut to using 'in( this
 any cacheBox([any configFile=''], [any cacheFactory=''], [any<Boolean> enabled='true'], [any classNamespace='[runtime expression]'])
          Integrate with CacheBox
 any configure()
          The main configuration method that must be overriden by a specific WireBox Binder configuration object
 any constructor(any constructor)
          You can choose what method will be treated as the constructor
 any getAppMapping()
          Get the ColdBox app mapping variable if context linked
 any<Struct> getCacheBoxConfig()
          Get the CacheBox Configuration Integration structure
 any<Controller> getColdBox()
          Get the bounded ColdBox context for this binder, if any
 any getCurrentMapping()
          Get the current set mapping (UTILITY method)
 any<struct> getCustomDSL()
          Get the custom dsl namespace registration structure
 struct getCustomScopes()
          Get the registered custom scopes
 any<Struct> getDefaults()
          Get the default WireBox settings structure
 any<Injector> getInjector()
          Get the bounded injector for this binder
 any<Array> getListeners()
          Get the configured listeners array
 any getLogBoxConfig()
          Get the logBox Configuration file to use
 any<Mapping> getMapping(any name)
          Get a specific object mapping: coldbox
 any<struct> getMappings()
          Get all the registered object mappings structure
 any<Struct> getMemento()
          Get the instance data structure
 any getParentInjector()
          Get the parent injector reference this binder is linked to
 any<struct> getProperties()
          Get the binded properties structure
 any getProperty(any name, [any default])
          Get a binded property
 any<java.util.LinkedHashMap> getScanLocations()
          Get the linked map of package scan locations for CFCs
 any<Struct> getScopeRegistration()
          Get the scope registration details structure
 any<Array> getStopRecursions()
          Get all the stop recursion classes array
 any inCacheBox([any key=''], [any timeout=''], [any lastAccessTimeout=''], [any provider='default'])
          Map an object into CacheBox
 any initArg([any name], [any ref], [any dsl], [any value], [any javaCast])
          Map a constructor argument to a mapping
 any initWith()
          Positional or named value arguments to use when initializing the mapping
 any into(any scope)
          Map an object into a specific persistence scope
 any listener(any class, [any<Struct> properties='[runtime expression]'], [any name=''])
          Add a new listener configuration
 void loadDataDSL([any<struct> rawDSL])
          Load a data configuration CFC data DSL
 any logBoxConfig(any config)
          Set the logBox Configuration to use
 any map(any alias)
          Create a mapping to an object
 any mapDSL(any namespace, any path)
          Register a new custom dsl namespace
 any mapDirectory(any packagePath)
          Maps an entire instantiation path directory, please note that the unique name of each file will be used and also processed for alias inspection
 any mapPath(any path)
          Directly map to a path by using the last part of the path as the alias
 any mapScope(any annotation, any path)
          Register a new WireBox custom scope
 any<Boolean> mappingExists(any name)
          Check if an object mapping exists
 any methodArg([any name], [any ref], [any dsl], [any value], [any javaCast])
          Map a method argument to a factory method
 any noAutowire()
          If you call this method on an object mapping, the object will NOT be inspected for injection/wiring metadata, it will use ONLY whatever you define in the mapping
 any noInit()
          If you call this method on an object mapping, the object's constructor will not be called
 any onDIComplete(any methods)
          The methods to execute once DI completes on the mapping
 any parentInjector(any injector)
          Link a parent injector to this configuration binder
 any processMappings()
          Process all registered mappings, called by injector when ready to start serving requests
 any property(any name, [any ref], [any dsl], [any value], [any javaCast], [any scope='variables'])
          Map a cfproperty to a mapping
 boolean propertyExists(any name)
          Checks if a property exists
 void removeScanLocations(any locations)
          Try to remove all the scan locations passed in
 void reset()
          Reset the configuration back to the original binder defaults
 any scanLocations(any locations)
          Register one or more package scan locations for CFC lookups
 any scopeRegistration([any<Boolean> enabled='[runtime expression]'], [any scope='[runtime expression]'], [any key='[runtime expression]'])
          Use to define injector scope registration
 any setProperties(any<struct> properties)
          Set the binded properties structure
 void setProperty(any name, any value)
          Create a new binding property
 any setter(any name, [any ref], [any dsl], [any value], [any javaCast])
          Map a setter function to a mapping
 any stopRecursions(any classes)
          Configure the stop recursion classes
 any to(any path)
          Map to a destination CFC class path
 any toDSL(any dsl)
          Map to a dsl that will be used to create the mapped object
 any toFactoryMethod(any factory, any method)
          Map to a factory and its executing method
 any toJava(any path)
          Map to a java destination class path
 any toProvider(any provider)
          Map to a provider object that must implement coldbox
 any toRSS(any path)
          Map to a rss destination class path
 any toValue(any value)
          Map to a constant value
 any toWebservice(any path)
          Map to a webservice destination class path
 any with(any alias)
          Used to set the current working mapping name in place for the maping DSL
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

public init(any<Injector> injector, [any config], [any<struct> properties='[runtime expression]'])
Constructor: You can pass a data CFC instance, data CFC path or nothing at all for purely programmatic configuration

Parameters:
injector - The Injector this binder is bound to
config - The WireBox Injector Data Configuration CFC instance or instantiation path to it. Leave blank if using this configuration object programatically
properties - A structure of binding properties to passthrough to the Binder Configuration CFC
Method Detail

asEagerInit

public any asEagerInit()
If this method is called, the mapped object will be created once the injector starts up. Basically, not lazy loaded


asSingleton

public any asSingleton()
Map as a singleton, shortcut to using 'in( this.SCOPES.SINGLETON )'


cacheBox

public any cacheBox([any configFile=''], [any cacheFactory=''], [any<Boolean> enabled='true'], [any classNamespace='[runtime expression]'])
Integrate with CacheBox

Parameters:
configFile - The configuration file to use for loading CacheBox if creating it.
cacheFactory - The CacheBox cache factory instance to link WireBox to
enabled - Enable or Disable CacheBox Integration, if you call this method then enabled is set to true as most likely you are trying to enable it
classNamespace - The package namespace to use for creating or connecting to CacheBox. Defaults to: coldbox.system.cache

configure

public any configure()
The main configuration method that must be overriden by a specific WireBox Binder configuration object


constructor

public any constructor(any constructor)
You can choose what method will be treated as the constructor. By default the value is 'init', so don't call this method if that is the case.

Parameters:
constructor - The constructor method to use for the mapped object

getAppMapping

public any getAppMapping()
Get the ColdBox app mapping variable if context linked


getCacheBoxConfig

public any<Struct> getCacheBoxConfig()
Get the CacheBox Configuration Integration structure


getColdBox

public any<Controller> getColdBox()
Get the bounded ColdBox context for this binder, if any


getCurrentMapping

public any getCurrentMapping()
Get the current set mapping (UTILITY method)


getCustomDSL

public any<struct> getCustomDSL()
Get the custom dsl namespace registration structure


getCustomScopes

public struct getCustomScopes()
Get the registered custom scopes


getDefaults

public any<Struct> getDefaults()
Get the default WireBox settings structure


getInjector

public any<Injector> getInjector()
Get the bounded injector for this binder


getListeners

public any<Array> getListeners()
Get the configured listeners array


getLogBoxConfig

public any getLogBoxConfig()
Get the logBox Configuration file to use


getMapping

public any<Mapping> getMapping(any name)
Get a specific object mapping: coldbox.system.ioc.config.Mapping

Parameters:
name - The name of the mapping to retrieve

getMappings

public any<struct> getMappings()
Get all the registered object mappings structure


getMemento

public any<Struct> getMemento()
Get the instance data structure


getParentInjector

public any getParentInjector()
Get the parent injector reference this binder is linked to


getProperties

public any<struct> getProperties()
Get the binded properties structure


getProperty

public any getProperty(any name, [any default])
Get a binded property. If not found it will try to return the default value passed, else it returns an exception

Parameters:
name - The name of the property
default - A default value if property does not exist

getScanLocations

public any<java.util.LinkedHashMap> getScanLocations()
Get the linked map of package scan locations for CFCs


getScopeRegistration

public any<Struct> getScopeRegistration()
Get the scope registration details structure


getStopRecursions

public any<Array> getStopRecursions()
Get all the stop recursion classes array


inCacheBox

public any inCacheBox([any key=''], [any timeout=''], [any lastAccessTimeout=''], [any provider='default'])
Map an object into CacheBox

Parameters:
key - You can override the key it will use for storing in cache. By default it uses the name of the mapping.
timeout - Object Timeout, else defaults to whatever the default is in the choosen cache
lastAccessTimeout - Object Timeout, else defaults to whatever the default is in the choosen cache
provider - Uses the 'default' cache provider by default

initArg

public any initArg([any name], [any ref], [any dsl], [any value], [any javaCast])
Map a constructor argument to a mapping

Parameters:
name - The name of the constructor argument. NA: JAVA-WEBSERVICE
ref - The reference mapping id this constructor argument maps to
dsl - The construction dsl this argument references. If used, the name value must be used.
value - The value of the constructor argument, if passed.
javaCast - The type of javaCast() to use on the value of the argument. Only used if using dsl or ref arguments

initWith

public any initWith()
Positional or named value arguments to use when initializing the mapping. (CFC-only)


into

public any into(any scope)
Map an object into a specific persistence scope

Parameters:
scope - The scope to map to, use a valid WireBox Scope by using binder.SCOPES.* or a custom scope

listener

public any listener(any class, [any<Struct> properties='[runtime expression]'], [any name=''])
Add a new listener configuration.

Parameters:
class - The class of the listener
properties - The structure of properties for the listner
name - The name of the listener

loadDataDSL

public void loadDataDSL([any<struct> rawDSL])
Load a data configuration CFC data DSL

Parameters:
rawDSL - The data configuration DSL structure to load, else look internally

logBoxConfig

public any logBoxConfig(any config)
Set the logBox Configuration to use

Parameters:
config - The configuration file to use

map

public any map(any alias)
Create a mapping to an object

Parameters:
alias - A single alias or a list or an array of aliases for this mapping. Remember an object can be refered by many names

mapDSL

public any mapDSL(any namespace, any path)
Register a new custom dsl namespace

Parameters:
namespace - The namespace you would like to register
path - The instantiation path to the CFC that implements this scope, it must have an init() method and implement: coldbox.system.ioc.dsl.IDSLBuilder

mapDirectory

public any mapDirectory(any packagePath)
Maps an entire instantiation path directory, please note that the unique name of each file will be used and also processed for alias inspection

Parameters:
packagePath - The instantiation packagePath to map

mapPath

public any mapPath(any path)
Directly map to a path by using the last part of the path as the alias. This is equivalent to map('MyService').to('model.MyService'). Only use if the name of the alias is the same as the last part of the path.

Parameters:
path - The class path to the object to map

mapScope

public any mapScope(any annotation, any path)
Register a new WireBox custom scope

Parameters:
annotation - The unique scope name to register. This translates to an annotation value on CFCs
path - The path to the CFC that implements this scope, it must have an init() method and implement: coldbox.system.ioc.scopes.IScope

mappingExists

public any<Boolean> mappingExists(any name)
Check if an object mapping exists

Parameters:
name - The name of the mapping to verify

methodArg

public any methodArg([any name], [any ref], [any dsl], [any value], [any javaCast])
Map a method argument to a factory method

Parameters:
name - The name of the argument
ref - The reference mapping id this method argument maps to
dsl - The construction dsl this argument references. If used, the name value must be used.
value - The value of the constructor argument, if passed.
javaCast - The type of javaCast() to use on the value of the argument. Only used if using dsl or ref arguments

noAutowire

public any noAutowire()
If you call this method on an object mapping, the object will NOT be inspected for injection/wiring metadata, it will use ONLY whatever you define in the mapping.


noInit

public any noInit()
If you call this method on an object mapping, the object's constructor will not be called. By default all constructors are called.


onDIComplete

public any onDIComplete(any methods)
The methods to execute once DI completes on the mapping

Parameters:
methods - A list or an array of methods to execute once the mapping is created, inited and DI has happened.

parentInjector

public any parentInjector(any injector)
Link a parent injector to this configuration binder

Parameters:
injector - A parent injector to configure link

processMappings

public any processMappings()
Process all registered mappings, called by injector when ready to start serving requests


property

public any property(any name, [any ref], [any dsl], [any value], [any javaCast], [any scope='variables'])
Map a cfproperty to a mapping

Parameters:
name - The name of the cfproperty to inject into
ref - The reference mapping id this property maps to
dsl - The construction dsl this property references. If used, the name value must be used.
value - The value of the property, if passed.
javaCast - The type of javaCast() to use on the value of the property. Only used if using dsl or ref arguments
scope - The scope in the CFC to inject the property to. By default it will inject it to the variables scope

propertyExists

public boolean propertyExists(any name)
Checks if a property exists

Parameters:
name - The name of the property

removeScanLocations

public void removeScanLocations(any locations)
Try to remove all the scan locations passed in

Parameters:
locations - Locations to remove from the lookup. A list or array of locations

reset

public void reset()
Reset the configuration back to the original binder defaults


scanLocations

public any scanLocations(any locations)
Register one or more package scan locations for CFC lookups

Parameters:
locations - A list or array of locations to add to package scanning.e.g.: ['coldbox','com.myapp','transfer']

scopeRegistration

public any scopeRegistration([any<Boolean> enabled='[runtime expression]'], [any scope='[runtime expression]'], [any key='[runtime expression]'])
Use to define injector scope registration

Parameters:
enabled - Enable registration or not (defaults=false) Boolean
scope - The scope to register on, defaults to application scope
key - The key to use in the scope, defaults to wireBox

setProperties

public any setProperties(any<struct> properties)
Set the binded properties structure

Parameters:
properties

setProperty

public void setProperty(any name, any value)
Create a new binding property

Parameters:
name - The name of the property
value - The value of the property

setter

public any setter(any name, [any ref], [any dsl], [any value], [any javaCast])
Map a setter function to a mapping

Parameters:
name - The name of the setter method (without 'set').
ref - The reference mapping object this setter method will receive
dsl - The construction dsl this setter method will receive
value - The value to pass into the setter method.
javaCast - The type of javaCast() to use on the value. Only used if using dsl or ref arguments

stopRecursions

public any stopRecursions(any classes)
Configure the stop recursion classes

Parameters:
classes - A list or array of classes to use so the injector can stop when looking for dependencies in inheritance chains

to

public any to(any path)
Map to a destination CFC class path.

Parameters:
path - The class path to the object to map

toDSL

public any toDSL(any dsl)
Map to a dsl that will be used to create the mapped object

Parameters:
dsl - The DSL string to use

toFactoryMethod

public any toFactoryMethod(any factory, any method)
Map to a factory and its executing method.

Parameters:
factory - The mapping factory reference name
method - The method to execute

toJava

public any toJava(any path)
Map to a java destination class path.

Parameters:
path - The class path to the object to map

toProvider

public any toProvider(any provider)
Map to a provider object that must implement coldbox.system.ioc.IProvider

Parameters:
provider - The provider to map to

toRSS

public any toRSS(any path)
Map to a rss destination class path.

Parameters:
path - The class path to the object to map

toValue

public any toValue(any value)
Map to a constant value

Parameters:
value - The value to bind to

toWebservice

public any toWebservice(any path)
Map to a webservice destination class path.

Parameters:
path - The class path to the object to map

with

public any with(any alias)
Used to set the current working mapping name in place for the maping DSL. An exception is thrown if the mapping does not exist yet.

Parameters:
alias - The name of the maping to set as current for working with it via the mapping DSL

ColdBox Platform Version 3.0.0