railo-context.Component coldbox.system.ioc.config.Binder
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
|
bindAspect(Matcher<Matcher> classes, Matcher<Matcher> methods, any aspects)
Bind a aspects to classes and methods. |
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
|
extraAttributes(struct data)
Adds a structure of metadata to be stored with the mapping for later retrieval by the developer in events, manually or builders. |
any
|
getAppMapping()
Get the ColdBox app mapping variable if context linked. |
any<array>
|
getAspectBindings()
Get the collection of aspect bindings for this binder. |
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], [any required='true'])
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, [any force='false'])
Create a mapping to an object. |
any
|
mapAspect(any aspect, boolean autoBinding='true')
Map a new aspect. |
any
|
mapDirectory(any packagePath, any include='', any exclude='', [any influence], [any filter], [any namespace=''], [any prepend='false'])
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
|
mapDSL(any namespace, any path)
Register a new custom dsl namespace. |
any
|
mapPath(any path, [any namespace=''], [any prepend='false'], [any force='false'])
Directly map to a path by using the last part of the path as the alias. |
any<Boolean>
|
mappingExists(any name)
Check if an object mapping exists. |
any
|
mapScope(any annotation, any path)
Register a new WireBox custom scope. |
any
|
match()
Create a new matcher class for usage in class or method matching. |
any
|
methodArg([any name], [any ref], [any dsl], [any value], [any javaCast])
Map a method argument to a factory method. |
any
|
mixins(any mixins='')
Adds one, a list or an array of UDF templates to mixin to a CFC. |
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
|
notThreadSafe()
This is the default wiring of objects that allow circular dependencies. |
any
|
onDIComplete(any methods)
The methods to execute once DI completes on the mapping. |
any
|
parent(any alias)
this method lets you use an abstract or parent mapping as a template for other like objects. |
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'], [any required='true'])
Map a cfproperty to a mapping. |
boolean
|
propertyExists(any name)
Checks if a property exists. |
any
|
providerMethod(any method, any mapping)
Add a new provider method mapping. |
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
|
setMapping(any name, any mapping)
Set a mapping object into the mappings map. |
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], [any argName])
Map a setter function to a mapping. |
any
|
stopRecursions(any classes)
Configure the stop recursion classes. |
any
|
threadSafe()
Tells persistence scopes to build, wire, and do onDIComplete() on objects in an isolated lock. |
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
|
unMap(any name)
Destroys a mapping by name. |
any
|
virtualInheritance(any mapping)
Tells WireBox to do a virtual inheritance mixin of the target and this passed mapping. |
any
|
with(any alias)
Used to set the current working mapping name in place for the maping DSL. |
Methods inherited from class railo-context.Component |
---|
None |
Constructor Detail |
---|
Constructor: You can pass a data CFC instance, data CFC path or nothing at all for purely programmatic configuration
injector
- The Injector this binder is bound toconfig
- The WireBox Injector Data Configuration CFC instance or instantiation path to it. Leave blank if using this configuration object programaticallyproperties
- A structure of binding properties to passthrough to the Binder Configuration CFCMethod Detail |
---|
If this method is called, the mapped object will be created once the injector starts up. Basically, not lazy loaded
Map as a singleton, shortcut to using 'in( this.SCOPES.SINGLETON )'
Bind a aspects to classes and methods
classes
- The class matcher that will be affected with this aspect bindingmethods
- The method matcher that will be affected with this aspect bindingaspects
- The name or list of names or array of names of aspects to apply to the classes and method matchersIntegrate with CacheBox
configFile
- The configuration file to use for loading CacheBox if creating it.cacheFactory
- The CacheBox cache factory instance to link WireBox toenabled
- Enable or Disable CacheBox Integration, if you call this method then enabled is set to true as most likely you are trying to enable itclassNamespace
- The package namespace to use for creating or connecting to CacheBox. Defaults to: coldbox.system.cacheThe main configuration method that must be overriden by a specific WireBox Binder configuration object
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.
constructor
- The constructor method to use for the mapped objectAdds a structure of metadata to be stored with the mapping for later retrieval by the developer in events, manually or builders.
data
- The data structure to store with the mapingGet the ColdBox app mapping variable if context linked
Get the collection of aspect bindings for this binder
Get the CacheBox Configuration Integration structure
Get the bounded ColdBox context for this binder, if any
Get the current set mapping (UTILITY method)
Get the custom dsl namespace registration structure
Get the registered custom scopes
Get the default WireBox settings structure
Get the bounded injector for this binder
Get the configured listeners array
Get the logBox Configuration file to use
Get a specific object mapping: coldbox.system.ioc.config.Mapping
name
- The name of the mapping to retrieveGet all the registered object mappings structure
Get the instance data structure
Get the parent injector reference this binder is linked to
Get the binded properties structure
Get a binded property. If not found it will try to return the default value passed, else it returns an exception
name
- The name of the propertydefault
- A default value if property does not existGet the linked map of package scan locations for CFCs
Get the scope registration details structure
Get all the stop recursion classes array
Map an object into CacheBox
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 cachelastAccessTimeout
- Object Timeout, else defaults to whatever the default is in the choosen cacheprovider
- Uses the 'default' cache provider by defaultMap a constructor argument to a mapping
name
- The name of the constructor argument. NA: JAVA-WEBSERVICEref
- The reference mapping id this constructor argument maps todsl
- 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 argumentsrequired
- If the argument is required or not, by default we assume required DI arguments.Positional or named value arguments to use when initializing the mapping. (CFC-only)
Map an object into a specific persistence scope
scope
- The scope to map to, use a valid WireBox Scope by using binder.SCOPES.* or a custom scopeAdd a new listener configuration.
class
- The class of the listenerproperties
- The structure of properties for the listnername
- The name of the listenerLoad a data configuration CFC data DSL
rawDSL
- The data configuration DSL structure to load, else look internallySet the logBox Configuration to use
config
- The configuration file to useCreate a mapping to an object
alias
- A single alias or a list or an array of aliases for this mapping. Remember an object can be refered by many namesforce
- Forces the registration of the mapping in case it already existsMap a new aspect
aspect
- The name or aliases of the aspectautoBinding
- Allow autobinding of this aspect or not? Defaults to trueMaps an entire instantiation path directory, please note that the unique name of each file will be used and also processed for alias inspection
packagePath
- The instantiation packagePath to mapinclude
- An include regex that if matches will only include CFCs that match this case insensitive regexexclude
- An exclude regex that if matches will exclude CFCs that match this case insensitive regexinfluence
- The influence closure or UDF that will receive the currently working mapping so you can influence it during the iterationsfilter
- The filter closure or UDF that will receive the path of the CFC to process and returns TRUE to continue processing or FALSE to skip processingnamespace
- Provide namespace to merge it inprepend
- where to attach the namespaceRegister a new custom dsl namespace
namespace
- The namespace you would like to registerpath
- The instantiation path to the CFC that implements this scope, it must have an init() method and implement: coldbox.system.ioc.dsl.IDSLBuilderDirectly 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.
path
- The class path to the object to mapnamespace
- Provide namespace to merge it inprepend
- Where to attach the namespaceforce
- Forces the registration of the mapping in case it already existsCheck if an object mapping exists
name
- The name of the mapping to verifyRegister a new WireBox custom scope
annotation
- The unique scope name to register. This translates to an annotation value on CFCspath
- The path to the CFC that implements this scope, it must have an init() method and implement: coldbox.system.ioc.scopes.IScopeCreate a new matcher class for usage in class or method matching
Map a method argument to a factory method
name
- The name of the argumentref
- The reference mapping id this method argument maps todsl
- 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 argumentsAdds one, a list or an array of UDF templates to mixin to a CFC
mixins
- The udf include location(s) to mixin at runtimeIf 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.
If you call this method on an object mapping, the object's constructor will not be called. By default all constructors are called.
This is the default wiring of objects that allow circular dependencies. By default all object's constructors are the only thread safe areas
The methods to execute once DI completes on the mapping
methods
- A list or an array of methods to execute once the mapping is created, inited and DI has happened.this method lets you use an abstract or parent mapping as a template for other like objects
alias
- The parent class to copy dependencies and definitions fromLink a parent injector to this configuration binder
injector
- A parent injector to configure linkProcess all registered mappings, called by injector when ready to start serving requests
Map a cfproperty to a mapping
name
- The name of the cfproperty to inject intoref
- The reference mapping id this property maps todsl
- 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 argumentsscope
- The scope in the CFC to inject the property to. By default it will inject it to the variables scoperequired
- If the property is required or not, by default we assume required DI properties.Checks if a property exists
name
- The name of the propertyAdd a new provider method mapping
method
- The provided method to override or inject as a providermapping
- The mapping to provide via the selected methodTry to remove all the scan locations passed in
locations
- Locations to remove from the lookup. A list or array of locationsReset the configuration back to the original binder defaults
Register one or more package scan locations for CFC lookups
locations
- A list or array of locations to add to package scanning.e.g.: ['coldbox','com.myapp','transfer']Use to define injector scope registration
enabled
- Enable registration or not (defaults=false) Booleanscope
- The scope to register on, defaults to application scopekey
- The key to use in the scope, defaults to wireBoxSet a mapping object into the mappings map
name
- The name of the mapping to registermapping
- The mapping object to registerSet the binded properties structure
properties
Create a new binding property
name
- The name of the propertyvalue
- The value of the propertyMap a setter function to a mapping
name
- The name of the setter method (without 'set').ref
- The reference mapping object this setter method will receivedsl
- The construction dsl this setter method will receivevalue
- 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 argumentsargName
- The name of the argument to use, if not passed, we default it to the setter nameConfigure the stop recursion classes
classes
- A list or array of classes to use so the injector can stop when looking for dependencies in inheritance chainsTells persistence scopes to build, wire, and do onDIComplete() on objects in an isolated lock. This will disallow circular references unless object providers are used. By default all object's constructors are the only thread safe areas
Map to a destination CFC class path.
path
- The class path to the object to mapMap to a dsl that will be used to create the mapped object
dsl
- The DSL string to useMap to a factory and its executing method.
factory
- The mapping factory reference namemethod
- The method to executeMap to a java destination class path.
path
- The class path to the object to mapMap to a provider object that must implement coldbox.system.ioc.IProvider or a closure or UDF
provider
- The provider to map toMap to a rss destination class path.
path
- The class path to the object to mapMap to a constant value
value
- The value to bind toMap to a webservice destination class path.
path
- The class path to the object to mapDestroys a mapping by name
name
- The name of the mapping to registerTells WireBox to do a virtual inheritance mixin of the target and this passed mapping
mapping
- The mapping name of CFC to create the virtual inheritance from.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.
alias
- The name of the maping to set as current for working with it via the mapping DSL