Packageorg.pranaframework.utils
Classpublic class MetadataUtils

This class provides utility methods concerning metadata. Retrieved metadata is cached and cleared with the set interval.

See also

CLEAR_CACHE_INTERVAL


Public Properties
 PropertyDefined by
  CLEAR_CACHE_INTERVAL : uint = 60000
[static] The interval (in miliseconds) at which the cache will be cleared.
MetadataUtils
Public Methods
 MethodDefined by
  
clearCache():void
[static] Allows you to clear the internal cache.
MetadataUtils
  
getFromObject(object:Object):XML
[static] Will return the metadata for the given object or class.
MetadataUtils
  
getFromString(className:String):XML
[static] Will retrieve the metadata for the given class.
MetadataUtils
Property detail
CLEAR_CACHE_INTERVALproperty
public static var CLEAR_CACHE_INTERVAL:uint = 60000

The interval (in miliseconds) at which the cache will be cleared. Note that this value is only used on the first call to getFromObject.

The default value is 60000 (one minute).

Method detail
clearCache()method
public static function clearCache():void

Allows you to clear the internal cache.

getFromObject()method 
public static function getFromObject(object:Object):XML

Will return the metadata for the given object or class. If metadata has already been requested for this type, it will be retrieved from cache. Note that the metadata will allways be that of the class, even if you pass an instance.

In order to get instance specific metadata, use the 'factory' property.

The reason we do not allow retrieval of instance metadata is because then we would need to cache the metadata double. Metadata takes up a significant amount of memory.

Parameters
object:Object — The object from which you want to grab the metadata

Returns
XML — The class metadata of the given object.
getFromString()method 
public static function getFromString(className:String):XML

Will retrieve the metadata for the given class. Note that in order to access properties and methods you need to grab the 'factory' part of the metadata.

Parameters
className:String — The name of the class that you want to retrieve metadata from. The className may be in the following forms: package.Class or package::Class

Returns
XML