coldbox.system.plugins

Class BeanFactory

WEB-INF.cftags.component
        extended by coldbox.system.FrameworkSupertype
            extended by coldbox.system.Plugin
                extended by coldbox.system.plugins.BeanFactory
Class Attributes:
  • singleton
  •  
  • output : false
  •  

    I am a plugin that taps into WireBox. I will be eventually removed as you can access wirebox directly :)

    Constructor Summary
    init(any controller)
          constructor.
    Method Summary
    void appendExternalLocations(any locations)
         Try to append a new model external location.
    void autowire(any target, [any<Mapping> mapping], [any targetID=''], [any<Boolean> annotationCheck='false'])
         Autowire an object using the ColdBox DSL.
    any getModel([any name], [any dsl], [any<struct> initArguments='[runtime expression]'])
         Create or retrieve model objects by convention.
    string locateModel(any name, [any resolveAlias='false'])
         Get the location instantiation path for a model object.
    Any populateBean(any target, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])
         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=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])
         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=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])
         Populate a named or instantiated bean from query.
    any populateFromQueryWithPrefix(any target, query qry, [Numeric RowNumber='1'], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], string prefix, [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])
         Populates an Object using only specific columns from a query.
    any populateFromStruct(any target, struct memento, [string scope], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])
         Populate a named or instantiated bean from a structure.
    any populateFromStructWithPrefix(any target, struct memento, [string scope], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'], string prefix)
         Populate a named or instantiated bean from a structure.
    any populateFromXML(any target, any xml, [string root=''], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])
         Populate a named or instantiated bean from an XML packet.
    Any populateModel(any model, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])
         Populate a named or instantiated model (java/cfc) from the request collection items.
    void removeExternalLocations(any locations)
         Try to remove all the external locations passed in.
     
    Methods inherited from class coldbox.system.Plugin
    getPluginDescription, getPluginName, getPluginVersion, getRequestCollection, getRequestContext, getpluginAuthor, getpluginAuthorURL, getpluginPath, setPluginDescription, setPluginName, setPluginVersion, setpluginAuthor, setpluginAuthorURL
     
    Methods inherited from class coldbox.system.FrameworkSupertype
    $abort, $dump, $htmlhead, $include, $rethrow, $throw, addAsset, announceInterception, getColdboxOCM, getController, getDatasource, getDebugMode, getInterceptor, getMailService, getMailSettings, getMemento, getModuleSettings, getMyPlugin, getNewMail, getPlugin, getResource, getSetting, getSettingStructure, getSettingsBean, getValidationManager, getfwLocale, includeUDF, loadGlobalUDFLibraries, locateDirectoryPath, locateFilePath, persistVariables, relocate, renderExternalView, renderLayout, renderView, runEvent, setDebugMode, setNextEvent, setNextRoute, setSetting, setfwLocale, settingExists, validateModel
     
    Methods inherited from class WEB-INF.cftags.component
    None

    Constructor Detail

    init

    public init(any controller)

    constructor

    Parameters:
    controller - coldbox.system.web.Controller

    Method Detail

    appendExternalLocations

    public void appendExternalLocations(any locations)

    Try to append a new model external location. @deprecated by 3.1

    Parameters:
    locations - Locations to add to the lookup, will be added in passed order. Comma delimited allowed.

    autowire

    public void autowire(any target, [any<Mapping> mapping], [any targetID=''], [any<Boolean> annotationCheck='false'])

    Autowire an object using the ColdBox DSL

    Parameters:
    target - The target object to wire up
    mapping - The object mapping with all the necessary wiring metadata. Usually passed by scopes and not a-la-carte autowires
    targetID - A unique identifier for this target to wire up. Usually a class path or file path should do. If none is passed we will get the id from the passed target via introspection but it will slow down the wiring
    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 anything automatically.

    getModel

    public any getModel([any name], [any dsl], [any<struct> initArguments='[runtime expression]'])

    Create or retrieve model objects by convention.

    Overrides:
    getModel in class FrameworkSupertype
    Parameters:
    name - The mapping name or CFC instance path to try to build up
    dsl - The dsl string to use to retrieve the instance model object, mutually exclusive with 'name'
    initArguments - The constructor structure of arguments to passthrough when initializing the instance

    locateModel

    public string locateModel(any name, [any resolveAlias='false'])

    Get the location instantiation path for a model object. If the model location is not found, this method returns an empty string. @deprecated by 3.1

    Parameters:
    name - The model to locate
    resolveAlias - Resolve model aliases

    populateBean

    public Any populateBean(any target, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])

    Populate a named or instantiated bean (java/cfc) from the request collection items

    Parameters:
    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 bean
    include - A list of keys to include in the population
    exclude - A list of keys to exclude in the population
    ignoreEmpty - Ignore empty values on populations, great for ORM population
    nullEmptyInclude - A list of keys to NULL when empty
    nullEmptyExclude - A list of keys to NOT NULL when empty
    composeRelationships - Automatically attempt to compose relationships from memento

    populateFromJSON

    public any populateFromJSON(any target, string JSONString, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])

    Populate a named or instantiated bean from a json string

    Parameters:
    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 bean
    include - A list of keys to include in the population
    exclude - A list of keys to exclude in the population
    ignoreEmpty - Ignore empty values on populations, great for ORM population
    nullEmptyInclude - A list of keys to NULL when empty
    nullEmptyExclude - A list of keys to NOT NULL when empty
    composeRelationships - Automatically attempt to compose relationships from memento

    populateFromQuery

    public any populateFromQuery(any target, query qry, [Numeric RowNumber='1'], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])

    Populate a named or instantiated bean from query

    Parameters:
    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 with
    RowNumber - The query row number to use for population
    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 bean
    include - A list of keys to include in the population
    exclude - A list of keys to exclude in the population
    ignoreEmpty - Ignore empty values on populations, great for ORM population
    nullEmptyInclude - A list of keys to NULL when empty
    nullEmptyExclude - A list of keys to NOT NULL when empty
    composeRelationships - Automatically attempt to compose relationships from memento

    populateFromQueryWithPrefix

    public any populateFromQueryWithPrefix(any target, query qry, [Numeric RowNumber='1'], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], string prefix, [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])

    Populates an Object using only specific columns from a query. Useful for performing a query with joins that needs to populate multiple objects.

    Parameters:
    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 with
    RowNumber - The query row number to use for population
    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 bean
    include - A list of keys to include in the population
    exclude - A list of keys to exclude in the population
    prefix - The prefix used to filter, Example: 'user_' would apply to the following columns: 'user_id' and 'user_name' but not 'address_id'.
    ignoreEmpty - Ignore empty values on populations, great for ORM population
    nullEmptyInclude - A list of keys to NULL when empty
    nullEmptyExclude - A list of keys to NOT NULL when empty
    composeRelationships - Automatically attempt to compose relationships from memento

    populateFromStruct

    public any populateFromStruct(any target, struct memento, [string scope], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])

    Populate a named or instantiated bean from a structure

    Parameters:
    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 bean
    include - A list of keys to include in the population
    exclude - A list of keys to exclude in the population
    ignoreEmpty - Ignore empty values on populations, great for ORM population
    nullEmptyInclude - A list of keys to NULL when empty
    nullEmptyExclude - A list of keys to NOT NULL when empty
    composeRelationships - Automatically attempt to compose relationships from memento

    populateFromStructWithPrefix

    public any populateFromStructWithPrefix(any target, struct memento, [string scope], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'], string prefix)

    Populate a named or instantiated bean from a structure

    Parameters:
    target - The target to populate
    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 bean
    include - A list of keys to include in the population
    exclude - A list of keys to exclude in the population
    ignoreEmpty - Ignore empty values on populations, great for ORM population
    nullEmptyInclude - A list of keys to NULL when empty
    nullEmptyExclude - A list of keys to NOT NULL when empty
    composeRelationships - Automatically attempt to compose relationships from memento
    prefix - The prefix used to filter, Example: 'user' would apply to the following formfield: 'user_id' and 'user_name' but not 'address_id'.

    populateFromXML

    public any populateFromXML(any target, any xml, [string root=''], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])

    Populate a named or instantiated bean from an XML packet

    Parameters:
    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()
    xml - The XML string or packet
    root - The XML root element to start from
    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 bean
    include - A list of keys to include in the population
    exclude - A list of keys to exclude in the population
    ignoreEmpty - Ignore empty values on populations, great for ORM population
    nullEmptyInclude - A list of keys to NULL when empty
    nullEmptyExclude - A list of keys to NOT NULL when empty
    composeRelationships - Automatically attempt to compose relationships from memento

    populateModel

    public Any populateModel(any model, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='false'])

    Populate a named or instantiated model (java/cfc) from the request collection items

    Overrides:
    populateModel in class FrameworkSupertype
    Parameters:
    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() method
    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 bean
    include - A list of keys to include in the population
    exclude - A list of keys to exclude in the population
    ignoreEmpty - Ignore empty values on populations, great for ORM population
    nullEmptyInclude - A list of keys to NULL when empty
    nullEmptyExclude - A list of keys to NOT NULL when empty
    composeRelationships - Automatically attempt to compose relationships from memento

    removeExternalLocations

    public void removeExternalLocations(any locations)

    Try to remove all the external locations passed in. @deprecated by 3.1

    Parameters:
    locations - Locations to remove from the lookup. Comma delimited allowed.