Adobe ColdFusion 8

Using the GetMetaData function

The CFML GetMetaData function returns a structure that contains all the metadata of a CFC instance. This structure contains substantially more data about the CFC than the cfdump tag shows, and includes the following information:

  • All attributes to the component tag, including any metadata-only attributes, plus the component path.
  • An array of structures that contains complete information on each method (function) in the component. This information describes all attributes, including metadata-only function and parameter attributes.
  • Within each function structure, a Parameters element that contains an array of parameters specified by cfargument tags. Information on each parameter includes any metadata-only attributes.
  • Information about any properties that are specified using the cfproperty tag.

Display metadata for a CFC

  1. Create the tellAboutCfcs.cfm file in the same directory as the telltime.cfc file, with the following code:
    <!--- Create an instance of the component. --->
    <cfobject component="tellTime" name="tellTimeObj">
    <!--- Create a new structure. --->
    <cfset aboutcfc=structNew()>
    <!--- Populate the structure with the metadata for the
                tellTimeObj instance of the tellTime CFC. --->
    <cfset aboutcfc=GetMetaData(tellTimeObj)>
    <cfdump var="aboutcfc">
    

  2. View the tellAboutCfcs.cfm file in a browser.

For information on how to specify CFC metadata, including how to use component tags and how to specify metadata-only attributes, see Documenting CFCs.