| Package: MachII.framework |
| The Event object encapsulates the event args. |
| Method Summary | |
|---|---|
| public Event |
init([string name=""], [struct args="#StructNew()#"], [string requestName=""], [string requestModuleName=""], [string moduleName=""])
Used by the framework for initialization. Do not override. |
| public any |
getArg(string name, [any defaultValue=""])
Returns the value of an arg or the default value if the arg is not defined. |
| public struct |
getArgs()
Returns all args in this event. |
| public string |
getArgType(string argName)
Returns the arg type of the arg name. |
| public string |
getModuleName()
Returns the module name of the event object. |
| public string |
getName()
Returns the name of the event object. |
| public string |
getRequestModuleName()
Returns the module name that started the request lifecycle. |
| public string |
getRequestName()
Returns the event name that started the request lifecycle. |
| public boolean |
isArgDefined(string name)
Checks if an arg is defined in the event object. |
| public void |
removeArg(string name)
Deletes an arg from the even object. |
| public void |
setArg(string name, any value, [string argType])
Sets an arg in the event object. |
| public void |
setArgs(struct args)
Sets a structure of args to the event object. |
| public void |
setArgType(string argName, string argType)
Sets the arg type for the specified arg. |
| public void |
setModuleName(string moduleName)
Sets the module name of the event object. (Not for public use.) |
| public void |
setName(string name)
Sets the name of the event object. (Not for public use.) |
| public void |
setRequestModuleName(string requestModuleName)
Sets the module name that started the request lifecycle. (Not for public use.) |
| public void |
setRequestName(string requestName)
Sets the event name that started the request lifecycle. (Not for public use.) |
| Method Detail |
|---|
| getArg |
|---|
public any getArg( string name, [any defaultValue=""] )
Returns the value of an arg or the default value if the arg is not defined.
Parameters:
| string name |
| [any defaultValue=""] |
Code:
<cffunction name="getArg" access="public" returntype="any" output="false" hint="Returns the value of an arg or the default value if the arg is not defined."> <cfargument name="name" type="string" required="true" hint="Name of arg to get in the event object." /> <cfargument name="defaultValue" type="any" required="false" default="" hint="Used to return a default value if the arg does not exist in the event object." /> <cfif StructKeyExists(variables.args, arguments.name)> <cfreturn variables.args[arguments.name] /> <cfelse> <cfreturn arguments.defaultValue /> </cfif> </cffunction>
| getArgs |
|---|
public struct getArgs( )
Returns all args in this event.
Parameters:
Code:
<cffunction name="getArgs" access="public" returntype="struct" output="false" hint="Returns all args in this event."> <cfreturn variables.args /> </cffunction>
| getArgType |
|---|
public string getArgType( string argName )
Returns the arg type of the arg name.
Parameters:
| string argName |
Code:
<cffunction name="getArgType" access="public" returntype="string" output="false" hint="Returns the arg type of the arg name."> <cfargument name="argName" type="string" required="true" hint="The name of the arg to get the arg type." /> <cfif StructKeyExists(variables.argTypes, arguments.argName)> <cfreturn variables.argTypes[arguments.argName] /> <cfelse> <cfreturn "" /> </cfif> </cffunction>
| getModuleName |
|---|
public string getModuleName( )
Returns the module name of the event object.
Parameters:
Code:
<cffunction name="getModuleName" access="public" returntype="string" output="false" hint="Returns the module name of the event object."> <cfreturn variables.moduleName /> </cffunction>
| getName |
|---|
public string getName( )
Returns the name of the event object.
Parameters:
Code:
<cffunction name="getName" access="public" returntype="string" output="false" hint="Returns the name of the event object."> <cfreturn variables.name /> </cffunction>
| getRequestModuleName |
|---|
public string getRequestModuleName( )
Returns the module name that started the request lifecycle.
Parameters:
Code:
<cffunction name="getRequestModuleName" access="public" returntype="string" output="false" hint="Returns the module name that started the request lifecycle."> <cfreturn variables.requestModuleName /> </cffunction>
| getRequestName |
|---|
public string getRequestName( )
Returns the event name that started the request lifecycle.
Parameters:
Code:
<cffunction name="getRequestName" access="public" returntype="string" output="false" hint="Returns the event name that started the request lifecycle."> <cfreturn variables.requestName /> </cffunction>
| init |
|---|
public Event init( [string name=""], [struct args="#StructNew()#"], [string requestName=""], [string requestModuleName=""], [string moduleName=""] )
Used by the framework for initialization. Do not override.
Parameters:
| [string name=""] |
| [struct args="#StructNew()#"] |
| [string requestName=""] |
| [string requestModuleName=""] |
| [string moduleName=""] |
Code:
<cffunction name="init" access="public" returntype="Event" output="false" hint="Used by the framework for initialization. Do not override."> <cfargument name="name" type="string" required="false" default="" hint="The name of the event object." /> <cfargument name="args" type="struct" required="false" default="#StructNew()#" hint="Event args to populate this event object." /> <cfargument name="requestName" type="string" required="false" default="" hint="The request event name for this request lifecycle." /> <cfargument name="requestModuleName" type="string" required="false" default="" hint="The request module name for this request lifecycle." /> <cfargument name="moduleName" type="string" required="false" default="" hint="The module name of the event object." /> <cfset setName(arguments.name) /> <cfset setArgs(arguments.args) /> <cfset setRequestName(arguments.requestName) /> <cfset setRequestModuleName(arguments.requestModuleName) /> <cfset setModuleName(arguments.moduleName) /> <cfreturn this /> </cffunction>
| isArgDefined |
|---|
public boolean isArgDefined( string name )
Checks if an arg is defined in the event object.
Parameters:
| string name |
Code:
<cffunction name="isArgDefined" access="public" returntype="boolean" output="false" hint="Checks if an arg is defined in the event object."> <cfargument name="name" type="string" required="true" hint="Name of arg to check." /> <cfreturn StructKeyExists(variables.args, arguments.name) /> </cffunction>
| removeArg |
|---|
public void removeArg( string name )
Deletes an arg from the even object.
Parameters:
| string name |
Code:
<cffunction name="removeArg" access="public" returntype="void" output="false" hint="Deletes an arg from the even object."> <cfargument name="name" type="string" required="true" hint="Name of arg to delete from the event object." /> <cfset StructDelete(variables.args, arguments.name) /> </cffunction>
| setArg |
|---|
public void setArg( string name, any value, [string argType] )
Sets an arg in the event object.
Parameters:
| string name |
| any value |
| [string argType] |
Code:
<cffunction name="setArg" access="public" returntype="void" output="false" hint="Sets an arg in the event object."> <cfargument name="name" type="string" required="true" hint="The name of the arg to set." /> <cfargument name="value" type="any" required="true" hint="The value of the arg to set." /> <cfargument name="argType" type="string" required="false" hint="The type of the arg to set." /> <cfset variables.args[arguments.name] = arguments.value /> <cfif StructKeyExists(arguments, 'argType')> <cfset setArgType(arguments.name, arguments.argType) /> </cfif> </cffunction>
| setArgs |
|---|
public void setArgs( struct args )
Sets a structure of args to the event object.
Parameters:
| struct args |
Code:
<cffunction name="setArgs" access="public" returntype="void" output="false" hint="Sets a structure of args to the event object."> <cfargument name="args" type="struct" required="true" hint="A structure of args to set." /> <cfset var key = "" /> <cfloop collection="#arguments.args#" item="key"> <cfset setArg(key, arguments.args[key]) /> </cfloop> </cffunction>
| setArgType |
|---|
public void setArgType( string argName, string argType )
Sets the arg type for the specified arg.
Parameters:
| string argName |
| string argType |
Code:
<cffunction name="setArgType" access="public" returntype="void" output="false" hint="Sets the arg type for the specified arg."> <cfargument name="argName" type="string" required="true" hint="The name of the arg." /> <cfargument name="argType" type="string" required="true" hint="The arg type to set." /> <cfset variables.argTypes[arguments.argName] = arguments.argType /> </cffunction>
| setModuleName |
|---|
public void setModuleName( string moduleName )
Sets the module name of the event object. (Not for public use.)
Parameters:
| string moduleName |
Code:
<cffunction name="setModuleName" access="public" returntype="void" output="false" hint="Sets the module name of the event object. (Not for public use.)"> <cfargument name="moduleName" type="string" required="true" hint="A module name for this event." /> <cfset variables.moduleName = arguments.moduleName /> </cffunction>
| setName |
|---|
public void setName( string name )
Sets the name of the event object. (Not for public use.)
Parameters:
| string name |
Code:
<cffunction name="setName" access="public" returntype="void" output="false" hint="Sets the name of the event object. (Not for public use.)"> <cfargument name="name" type="string" required="true" hint="A name for this event." /> <cfset variables.name = arguments.name /> </cffunction>
| setRequestModuleName |
|---|
public void setRequestModuleName( string requestModuleName )
Sets the module name that started the request lifecycle. (Not for public use.)
Parameters:
| string requestModuleName |
Code:
<cffunction name="setRequestModuleName" access="public" returntype="void" output="false" hint="Sets the module name that started the request lifecycle. (Not for public use.)"> <cfargument name="requestModuleName" type="string" required="true" hint="A request name for this event." /> <cfset variables.requestModuleName = arguments.requestModuleName /> </cffunction>
| setRequestName |
|---|
public void setRequestName( string requestName )
Sets the event name that started the request lifecycle. (Not for public use.)
Parameters:
| string requestName |
Code:
<cffunction name="setRequestName" access="public" returntype="void" output="false" hint="Sets the event name that started the request lifecycle. (Not for public use.)"> <cfargument name="requestName" type="string" required="true" hint="A request name for this event." /> <cfset variables.requestName = arguments.requestName /> </cffunction>