|
ColdBox Platform Version 2.6.3 | ||||
FRAMES |
WEB-INF.cftags.componentcoldbox.system.frameworkSupertype
coldbox.system.plugin
coldbox.system.plugins.beanFactory
public class beanFactory
I am the ColdBox beanFactory plugin that takes care of autowiring and dependency injection
Constructor Summary | |
---|---|
init(any controller)
constructor |
Method Summary | |
---|---|
void |
addModelMapping([string alias], string path)
Add a new model mapping. Ex: addModelMapping('myBean','security.test.FormBean'). The alias can be a single item or a comma delimmitted list |
void |
autowire(any target, [boolean useSetterInjection='true'], [boolean annotationCheck='false'], [string onDICompleteUDF='onDIComplete'], [boolean debugMode='false'], [string stopRecursion=''])
Autowire an object using the ColdBox DSL |
Any |
create(string bean)
Create a named bean, simple as that. If the bean has an init() method, it will be called. |
private any |
getColdboxDSL(any definition)
Get dependencies using the coldbox dependency DSL |
private struct |
getConstructorArguments(any model='', [boolean debugMode='false'])
The constructor argument collection for a model object |
private BaseDictionary |
getDICacheDictionary()
Get DICacheDictionary |
private any |
getDSLDependency(any definition, [boolean debugMode='false'])
get a dsl dependency |
private any |
getIOCDependency(any definition)
Get an IOC dependency |
private any |
getLibraryDSL(any Definition)
Get dependencies using the library dependency DSL |
any |
getModel(string name, [boolean useSetterInjection], [string onDICompleteUDF], [boolean debugMode], [string stopRecursion])
Create or retrieve model objects by convention |
private any |
getModelDSL(any definition, [boolean debugMode='false'])
Get dependencies using the model dependency DSL |
struct |
getModelMappings()
Get the model mappings structure |
private struct |
getNewMDEntry()
Get a new metadata entry structure |
private any |
getOCMDependency(any definition)
Get OCM dependencies |
private any |
getWebserviceDSL(any Definition)
Get webservice dependencies |
private void |
injectBean(any targetBean, string beanName, any beanObject, string scope)
Inject a bean with dependencies via setters or property injections |
private array |
parseMetadata(any metadata, array dependencies, [boolean useSetterInjection='true'], [string stopRecursion=''])
I get a components dependencies via searching for 'setters' |
Any |
populateBean(any formBean, [string scope=''], [boolean trustedSetter='false'])
Populate a named or instantiated bean (java/cfc) from the request collection items |
any |
populateFromJSON(any formBean, string JSONString, [string scope=''], [boolean trustedSetter='false'])
Populate a named or instantiated bean from a json string |
Any |
populateFromQuery(any formBean, query qry, [Numeric RowNumber='1'], [string scope=''], [boolean trustedSetter='false'])
Populate a named or instantiated bean from query |
any |
populateFromStruct(any formBean, struct memento, [string scope], [boolean trustedSetter='false'])
Populate a named or instantiated bean from a structure |
Any |
populateModel(any model, [string scope=''], [boolean trustedSetter='false'])
Populate a named or instantiated model (java/cfc) from the request collection items |
private void |
processAfterCompleteDI(any targetObject, [string onDICompleteUDF='onDIComplete'])
see if we have a method to call after DI, and if so, call it |
private void |
setDICacheDictionary(BaseDictionary DICacheDictionary)
Set DICacheDictionary |
private boolean |
stopClassRecursion(string classname, string stopRecursion)
Should we stop recursion or not due to class name found |
Methods inherited from class coldbox.system.plugin |
---|
getPluginDescription, getPluginName, getPluginVersion, getpluginPath, setPluginDescription, setPluginName, setPluginVersion
|
Methods inherited from class WEB-INF.cftags.component |
---|
|
Constructor Detail |
---|
public init(any controller)
Method Detail |
---|
public void addModelMapping([string alias], string path)
alias
- The model alias to use, this can also be a list of aliases. Ex: SecurityService,Securitypath
- The model class path (From the model conventions downward)public void autowire(any target, [boolean useSetterInjection='true'], [boolean annotationCheck='false'], [string onDICompleteUDF='onDIComplete'], [boolean debugMode='false'], [string stopRecursion=''])
target
- The object to autowireuseSetterInjection
- Whether to use setter injection alongside the annotations property injection. cfproperty injection takes precedence.annotationCheck
- This value determines if we check if the target contains an autowire annotation in the cfcomponent tag: autowire=true|false, it will only autowire if that metadata attribute is set to true. The default is false, which will autowire automatically.onDICompleteUDF
- After Dependencies are injected, this method will look for this UDF and call it if it exists. The default value is onDICompletedebugMode
- Whether to log debug messages. Default is falsestopRecursion
- The stop recursion class. Ex: transfer.com.TransferDecorator. By default all ColdBox base classes are included.public Any create(string bean)
bean
- The type of bean to create and return. Uses full cfc path mapping.Ex: coldbox.beans.exceptionBeanprivate any getColdboxDSL(any definition)
definition
- The dependency definition structureprivate struct getConstructorArguments(any model='', [boolean debugMode='false'])
model
- The model objectdebugMode
- Whether to log debug messages. Default is falseprivate BaseDictionary getDICacheDictionary()
private any getDSLDependency(any definition, [boolean debugMode='false'])
definition
- The dependency definition structuredebugMode
- Whether to log debug messages. Default is falseprivate any getIOCDependency(any definition)
definition
- The dependency definition structureprivate any getLibraryDSL(any Definition)
Definition
- The dependency definition structurepublic any getModel(string name, [boolean useSetterInjection], [string onDICompleteUDF], [boolean debugMode], [string stopRecursion])
getModel
in class
frameworkSupertype
name
- The name of the model to retrieveuseSetterInjection
- Whether to use setter injection alongside the annotations property injection. cfproperty injection takes precedence.onDICompleteUDF
- After Dependencies are injected, this method will look for this UDF and call it if it exists. The default value is onDICompletedebugMode
- Debugging Mode or notstopRecursion
- A comma-delimmited list of stoprecursion classpaths.private any getModelDSL(any definition, [boolean debugMode='false'])
definition
- The dependency definition structuredebugMode
- Whether to log debug messages. Default is falsepublic struct getModelMappings()
private struct getNewMDEntry()
private any getOCMDependency(any definition)
definition
- The dependency definition structureprivate any getWebserviceDSL(any Definition)
Definition
- The dependency definition structureprivate void injectBean(any targetBean, string beanName, any beanObject, string scope)
targetBean
- The bean that will be injected with dependenciesbeanName
- The name of the property to injectbeanObject
- The bean object to inject.scope
- The scope to inject a property into.private array parseMetadata(any metadata, array dependencies, [boolean useSetterInjection='true'], [string stopRecursion=''])
metadata
- The recursive metadatadependencies
- The dependenciesuseSetterInjection
- Whether to use setter injection alongside the annotations property injection. cfproperty injection takes precedence.stopRecursion
- The stop recursion classpublic Any populateBean(any formBean, [string scope=''], [boolean trustedSetter='false'])
formBean
- This can be an instantiated bean object or a bean instantitation path as a string. This method follows the bean contract (set{property_name}). Example: setUsername(), setfname()scope
- Use scope injection instead of setters population. Ex: scope=variables.instance.trustedSetter
- If set to true, the setter method will be called even if it does not exist in the beanpublic any populateFromJSON(any formBean, string JSONString, [string scope=''], [boolean trustedSetter='false'])
formBean
- This can be an instantiated bean object or a bean instantitation path as a string. If you pass an instantiation path and the bean has an 'init' method. It will be executed. This method follows the bean contract (set{property_name}). Example: setUsername(), setfname()JSONString
- The JSON string to populate the object with. It has to be valid JSON and also a structure with name-key value pairs. scope
- Use scope injection instead of setters population. Ex: scope=variables.instance.trustedSetter
- If set to true, the setter method will be called even if it does not exist in the beanpublic Any populateFromQuery(any formBean, query qry, [Numeric RowNumber='1'], [string scope=''], [boolean trustedSetter='false'])
formBean
- This can be an instantiated bean object or a bean instantitation path as a string. If you pass an instantiation path and the bean has an 'init' method. It will be executed. This method follows the bean contract (set{property_name}). Example: setUsername(), setfname()qry
- The query to popluate the bean object withRowNumber
- The query row number to use for populationscope
- Use scope injection instead of setters population. Ex: scope=variables.instance.trustedSetter
- If set to true, the setter method will be called even if it does not exist in the beanpublic any populateFromStruct(any formBean, struct memento, [string scope], [boolean trustedSetter='false'])
formBean
- This can be an instantiated bean object or a bean instantitation path as a string. If you pass an instantiation path and the bean has an 'init' method. It will be executed. This method follows the bean contract (set{property_name}). Example: setUsername(), setfname()memento
- The structure to populate the object with.scope
- Use scope injection instead of setters population.trustedSetter
- If set to true, the setter method will be called even if it does not exist in the beanpublic Any populateModel(any model, [string scope=''], [boolean trustedSetter='false'])
populateModel
in class
frameworkSupertype
model
- The name of the model to get and populate or the acutal model object. If you already have an instance of a model, then use the populateBean() methodscope
- Use scope injection instead of setters population. Ex: scope=variables.instance.trustedSetter
- If set to true, the setter method will be called even if it does not exist in the beanprivate void processAfterCompleteDI(any targetObject, [string onDICompleteUDF='onDIComplete'])
targetObject
- the target object to call ononDICompleteUDF
- After Dependencies are injected, this method will look for this UDF and call it if it exists.private void setDICacheDictionary(BaseDictionary DICacheDictionary)
DICacheDictionary
private boolean stopClassRecursion(string classname, string stopRecursion)
classname
- The class name to checkstopRecursion
- The comma delimmitted list of stoprecursion classes
|
ColdBox Platform Version 2.6.3 | ||||
FRAMES |