Packageorg.spicefactory.lib.reflect
Classpublic class ClassInfo
InheritanceClassInfo Inheritance MetadataAware Inheritance Object

Represents a class or interface and allows reflection on its name, properties and methods. Instances of this class can be obtained with one of the three static methods (forName, forClass or forInstance). ClassInfo instances are cached and rely on the XML returned by flash.utils.describeType internally.



Public Properties
 PropertyDefined By
  applicationDomain : ApplicationDomain
[read-only] The ApplicationDomain this class belongs to.
ClassInfo
  cache : ReflectionCache
[static] The reflection cache which keeps references to all ClassInfo instances created by the three static methods of this class.
ClassInfo
  name : String
[read-only] The fully qualified class name for this instance.
ClassInfo
  simpleName : String
[read-only] The non qualified class name for this instance.
ClassInfo
Public Methods
 MethodDefined By
  
forClass(clazz:Class, domain:ApplicationDomain = null):ClassInfo
[static] Returns an instance representing the specified class or interface.
ClassInfo
  
forInstance(instance:Object, domain:ApplicationDomain = null):ClassInfo
[static] Returns an instance representing the class of the specified instance.
ClassInfo
  
forName(name:String, domain:ApplicationDomain = null):ClassInfo
[static] Returns an instance representing the class or interface with the specified name.
ClassInfo
 Inherited
getAllMetadata(validate:Boolean = true):Array
Returns all metadata tags for this type in no particular order.
MetadataAware
  
getClass():Class
Returns the class this instance represents.
ClassInfo
  
Returns the constructor for this class.
ClassInfo
  
Returns all interfaces implemented by the class represented by this ClassInfo instance.
ClassInfo
 Inherited
getMetadata(type:Object, validate:Boolean = true):Array
Returns all metadata tags for the specified type for this element.
MetadataAware
  
getMethod(name:String, namespaceURI:String = null):Method
Returns the Method instance for the specified method name.
ClassInfo
  
getMethods():Array
Returns Method instances for all public, non-static methods of this class.
ClassInfo
  
Returns Property instances for all public, non-static properties of this class.
ClassInfo
  
getProperty(name:String, namespaceURI:String = null):Property
Returns the Property instance for the specified property name.
ClassInfo
  
getStaticMethod(name:String, namespaceURI:String = null):Method
Returns the Method instance for the specified method name.
ClassInfo
  
Returns Method instances for all public, static methods of this class.
ClassInfo
  
Returns Property instances for all public, static properties of this class.
ClassInfo
  
getStaticProperty(name:String, namespaceURI:String = null):Property
Returns the Property instance for the specified property name.
ClassInfo
  
Returns the superclass of the class represented by this ClassInfo instance.
ClassInfo
  
Returns all superclasses or superinterfaces of the class or interface represented by this ClassInfo instance.
ClassInfo
 Inherited
hasMetadata(type:Object):Boolean
Indicates whether this element has at least one metadata tag of the specified type.
MetadataAware
  
isInterface():Boolean
Indicates whether this type is an interface.
ClassInfo
  
isType(c:Class):Boolean
Checks whether the class or interface represented by this ClassInfo instance is a subclass or subinterface of the specified class.
ClassInfo
  
newInstance(constructorArgs:Array):Object
Creates a new instance of the class represented by this ClassInfo instance.
ClassInfo
  
purgeCache(domain:ApplicationDomain = null):void
Deprecated: Please Use cache.purgeDomain
[static]
ClassInfo
  
resolve(name:String, domain:ApplicationDomain):ClassInfo
[static]
ClassInfo
Public Constants
 ConstantDefined By
  currentDomain : ApplicationDomain
[static] The ApplicationDomain to be used when no domain was explicitly specified.
ClassInfo
Property Detail
applicationDomainproperty
applicationDomain:ApplicationDomain  [read-only]

The ApplicationDomain this class belongs to. It will be used to load all dependent classes referenced by properties or methods of this class.


Implementation
    public function get applicationDomain():ApplicationDomain
cacheproperty 
cache:ReflectionCache

The reflection cache which keeps references to all ClassInfo instances created by the three static methods of this class.


Implementation
    public static function get cache():ReflectionCache
    public static function set cache(value:ReflectionCache):void
nameproperty 
name:String  [read-only]

The fully qualified class name for this instance.


Implementation
    public function get name():String
simpleNameproperty 
simpleName:String  [read-only]

The non qualified class name for this instance.


Implementation
    public function get simpleName():String
Method Detail
forClass()method
public static function forClass(clazz:Class, domain:ApplicationDomain = null):ClassInfo

Returns an instance representing the specified class or interface. If the optional domain parameter is omitted ApplicationDomain.currentDomain will be used.

Parameters

clazz:Class — the class or interface to reflect on
 
domain:ApplicationDomain (default = null) — the ApplicationDomain the specified class was loaded from

Returns
ClassInfo — an instance representing the specified class or interface
forInstance()method 
public static function forInstance(instance:Object, domain:ApplicationDomain = null):ClassInfo

Returns an instance representing the class of the specified instance. If the optional domain parameter is omitted ApplicationDomain.currentDomain will be used.

Parameters

instance:Object — the instance to return the ClassInfo for
 
domain:ApplicationDomain (default = null)

Returns
ClassInfo — an instance representing the class of the specified instance
forName()method 
public static function forName(name:String, domain:ApplicationDomain = null):ClassInfo

Returns an instance representing the class or interface with the specified name. If the optional domain parameter is omitted ApplicationDomain.currentDomain will be used.

Parameters

name:String — the fully qualified name of the class or interface
 
domain:ApplicationDomain (default = null) — the ApplicationDomain to load the class from

Returns
ClassInfo — an instance representing the class or interface with the specified name

Throws
ReferenceError — if the class with the specified name does not exist
getClass()method 
public function getClass():Class

Returns the class this instance represents.

Returns
Class — the class this instance represents
getConstructor()method 
public function getConstructor():Constructor

Returns the constructor for this class. This method will return null for interfaces.

Returns
Constructor — the constructor for this class
getInterfaces()method 
public function getInterfaces():Array

Returns all interfaces implemented by the class represented by this ClassInfo instance.

Returns
Array — all interfaces implemented by the class represented by this ClassInfo instance
getMethod()method 
public function getMethod(name:String, namespaceURI:String = null):Method

Returns the Method instance for the specified method name. The method must be public, non-static and may be declared in this class or in one of its superclasses or superinterfaces.

Parameters

name:String — the name of the method
 
namespaceURI:String (default = null) — the namespace uri of the property

Returns
Method — the Method instance for the specified method name or null if no such method exists
getMethods()method 
public function getMethods():Array

Returns Method instances for all public, non-static methods of this class. Included are all methods declared in this class or in one of its superclasses or superinterfaces.

Returns
Array — Method instances for all public, non-static methods of this class
getProperties()method 
public function getProperties():Array

Returns Property instances for all public, non-static properties of this class. Included are all properties declared in this class or in one of its superclasses or superinterfaces with var, const or implicit getter/setter functions.

Returns
Array — Property instances for all public, non-static properties of this class
getProperty()method 
public function getProperty(name:String, namespaceURI:String = null):Property

Returns the Property instance for the specified property name. The property may be declared in this class or in one of its superclasses or superinterfaces. The property must be public and non-static and may have been declared with var, const or implicit getter/setter functions.

Parameters

name:String — the name of the property
 
namespaceURI:String (default = null) — the namespace uri of the property

Returns
Property — the Property instance for the specified property name or null if no such property exists
getStaticMethod()method 
public function getStaticMethod(name:String, namespaceURI:String = null):Method

Returns the Method instance for the specified method name. The method must be public, static and must be declared in this class.

Parameters

name:String — the name of the static method
 
namespaceURI:String (default = null) — the namespace uri of the property

Returns
Method — the Method instance for the specified method name or null if no such method exists
getStaticMethods()method 
public function getStaticMethods():Array

Returns Method instances for all public, static methods of this class. Included are all static methods declared in this class. Method instances for all public, static methods of this class

Returns
Array
getStaticProperties()method 
public function getStaticProperties():Array

Returns Property instances for all public, static properties of this class. Included are all static properties declared in this class with var, const or implicit getter/setter functions.

Returns
Array — Property instances for all public, static properties of this class
getStaticProperty()method 
public function getStaticProperty(name:String, namespaceURI:String = null):Property

Returns the Property instance for the specified property name. The property must be public and static and may have been declared with var, const or implicit getter/setter functions. Static properties of superclasses or superinterfaces are not included.

Parameters

name:String — the name of the static property
 
namespaceURI:String (default = null) — the namespace uri of the property

Returns
Property — the Property instance for the specified property name or null if no such property exists
getSuperClass()method 
public function getSuperClass():Class

Returns the superclass of the class represented by this ClassInfo instance.

Returns
Class — the superclass of the class represented by this ClassInfo instance
getSuperClasses()method 
public function getSuperClasses():Array

Returns all superclasses or superinterfaces of the class or interface represented by this ClassInfo instance. The first element in the Array is always the immediate superclass.

Returns
Array — all superclasses or superinterfaces of the class or interface represented by this ClassInfo instance
isInterface()method 
public function isInterface():Boolean

Indicates whether this type is an interface.

Returns
Boolean — true if this type is an interface
isType()method 
public function isType(c:Class):Boolean

Checks whether the class or interface represented by this ClassInfo instance is a subclass or subinterface of the specified class.

Parameters

c:Class

Returns
Boolean — true if the class or interface represented by this ClassInfo instance is a subclass or subinterface of the specified class
newInstance()method 
public function newInstance(constructorArgs:Array):Object

Creates a new instance of the class represented by this ClassInfo instance. This is just a shortcut for ClassInfo.getConstructor().newInstance().

Parameters

constructorArgs:Array — the argumenst to pass to the constructor

Returns
Object — a new instance of the class represented by this ClassInfo instance
purgeCache()method 
public static function purgeCache(domain:ApplicationDomain = null):void
Deprecated: Please Use cache.purgeDomain

Parameters

domain:ApplicationDomain (default = null)

resolve()method 
public static function resolve(name:String, domain:ApplicationDomain):ClassInfo

Parameters

name:String
 
domain:ApplicationDomain

Returns
ClassInfo
Constant Detail
currentDomainConstant
public static const currentDomain:ApplicationDomain

The ApplicationDomain to be used when no domain was explicitly specified. Points to ApplicationDomain.currentDomain but makes sure that always the same instance will be used. Since ApplicationDomain.currentDomain always returns a different instance it would be difficult to use domains as keys in Dictionaries otherwise.