|
ColdBox Platform Version 2.6.4 | ||||
| FRAMES | |||||
WEB-INF.cftags.component
coldbox.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 |
void |
appendExternalLocations(string locations)
Try to append a new model external location |
void |
autowire(any target, [boolean useSetterInjection='true'], [boolean annotationCheck='false'], [string onDICompleteUDF='onDIComplete'], [string stopRecursion=''])
Autowire an object using the ColdBox DSL |
BeanFactory |
configure()
Configure the bean factory for operation from the configuration file |
boolean |
containsModel(string name, [boolean resolveAlias='false'])
Checks if the factory has a model object definition found |
Any |
create(string bean)
Create a named bean, simple as that |
private any |
getColdboxDSL(any definition)
Get dependencies using the coldbox dependency DSL |
private struct |
getConstructorArguments(any model='')
The constructor argument collection for a model object |
private BaseDictionary |
getDICacheDictionary()
Get DICacheDictionary |
private any |
getDSLDependency(any definition)
get a dsl dependency |
private any |
getEntityServiceDSL(any definition)
Get a virtual entity service object |
string |
getExternalLocations()
Get all the registered external locations |
private any |
getIOCDependency(any definition)
Get an IOC dependency |
private any |
getJavaLoaderDSL(any definition)
Get JavaLoader Dependency |
private any |
getLogBoxDSL(any definition)
Get dependencies using the logbox dependency DSL |
any |
getModel(string name, [boolean useSetterInjection], [string onDICompleteUDF], [string stopRecursion])
Create or retrieve model objects by convention |
private any |
getModelDSL(any definition)
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 |
string |
locateModel(string name, [boolean resolveAlias='false'])
Get the location instantiation path for a model object |
private array |
parseMetadata(any metadata, array dependencies, [boolean useSetterInjection='true'], [string stopRecursion=''])
I get a components dependencies via searching for 'setters' |
Any |
populateBean(any target, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
Populate a named or instantiated bean (java/cfc) from the request collection items |
any |
populateFromJSON(any target, string JSONString, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
Populate a named or instantiated bean from a json string |
Any |
populateFromQuery(any target, query qry, [Numeric RowNumber='1'], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
Populate a named or instantiated bean from query |
any |
populateFromStruct(any target, struct memento, [string scope], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
Populate a named or instantiated bean from a structure |
Any |
populateModel(any model, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
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 |
void |
removeExternalLocations(string locations)
Try to remove all the external locations passed in |
string |
resolveModelAlias(string name)
Resolve the real name of any incoming argument model name or alias |
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 WEB-INF.cftags.component |
|---|
|
| Constructor Detail |
|---|
public init(any controller)
controller - coldbox.system.web.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 path (From the model conventions downward). Do not add full path, this is a conveniencepublic void appendExternalLocations(string locations)
locations - Locations to add to the lookup, will be added in passed order. Comma delimited allowed.public void autowire(any target, [boolean useSetterInjection='true'], [boolean annotationCheck='false'], [string onDICompleteUDF='onDIComplete'], [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 onDICompletestopRecursion - The stop recursion class. Ex: transfer.com.TransferDecorator. By default all ColdBox base classes are included.public BeanFactory configure()
public boolean containsModel(string name, [boolean resolveAlias='false'])
name - The name of the model to checkresolveAlias - Resolve model aliasespublic 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='')
model - The model objectprivate BaseDictionary getDICacheDictionary()
private any getDSLDependency(any definition)
definition - The dependency definition structureprivate any getEntityServiceDSL(any definition)
definition - The dependency definition structurepublic string getExternalLocations()
private any getIOCDependency(any definition)
definition - The dependency definition structureprivate any getJavaLoaderDSL(any definition)
definition - The dependency definition structureprivate any getLogBoxDSL(any definition)
definition - The dependency definition structurepublic any getModel(string name, [boolean useSetterInjection], [string onDICompleteUDF], [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 onDICompletestopRecursion - A comma-delimmited list of stoprecursion classpaths.private any getModelDSL(any definition)
definition - The dependency definition structurepublic 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.public string locateModel(string name, [boolean resolveAlias='false'])
name - The model to locateresolveAlias - Resolve model aliasesprivate 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 target, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
target - 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 beaninclude - A list of keys to include in the populationexclude - A list of keys to exclude in the populationpublic any populateFromJSON(any target, string JSONString, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
target - 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 beaninclude - A list of keys to include in the populationexclude - A list of keys to exclude in the populationpublic Any populateFromQuery(any target, query qry, [Numeric RowNumber='1'], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
target - 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 beaninclude - A list of keys to include in the populationexclude - A list of keys to exclude in the populationpublic any populateFromStruct(any target, struct memento, [string scope], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
target - 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 beaninclude - A list of keys to include in the populationexclude - A list of keys to exclude in the populationpublic Any populateModel(any model, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''])
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 beaninclude - A list of keys to include in the populationexclude - A list of keys to exclude in the populationprivate 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.public void removeExternalLocations(string locations)
locations - Locations to remove from the lookup. Comma delimited allowed.public string resolveModelAlias(string name)
name - The model alias or name to resolveprivate void setDICacheDictionary(BaseDictionary DICacheDictionary)
DICacheDictionaryprivate boolean stopClassRecursion(string classname, string stopRecursion)
classname - The class name to checkstopRecursion - The comma delimmitted list of stop recurssion classes
|
ColdBox Platform Version 2.6.4 | ||||
| FRAMES | |||||