Adobe COLDFUSION 9 Manual page 129

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
The CFML Programming Language
// this is a component
/**
*@hint "this is a hint for component"
*/
component displayname="My Component" {
pageencoding "Cp1252" ;
//
// The rest of the component definition goes here.
//
}
Note: Currently, you cannot use CFScript to specify the suppresswhitespace processing directive.
Accessing component metadata
To access metadata of a component, function, parameter, or property, use the GetMetadata function. Component
metadata includes the metadata of its properties and functions, including attributes and function parameters.
For detailed information about the structure and contents of the metadata, see GetMetaData in the CFML Reference.
The following trivial code shows the use of component metadata:
//Create an instance of a component.
theComponent=createObject("Component" "myComponent");
// Get the component metadata.
theMetadata = getMetadata(theComponent);
// The component properties are in an array. Display the name
// of the first property in the array.
writeoutput("Property name: " & theMetadata.properties[1].name);
Support for creating custom metadata
Note: To use this feature, you must install ColdFusion 9 Update 1.
You can specify custom metadata for function arguments in script syntax in either of the following ways:
• With arguments, as space-separated list of key-value pairs.
• In annotations, using
@arg1.custommetadata "custom value"
Example
custom.cfm
cfscript>
writeoutput(new custom().foo(10));
</cfscript>
custom.cfc
.
Last updated 8/5/2010
124

Advertisement

Table of Contents
loading

Table of Contents