Package | org.spicefactory.lib.reflect |
Class | public class ClassInfo |
Inheritance | ClassInfo MetadataAware Object |
forName
,
forClass
or forInstance
). ClassInfo instances are cached and rely on
the XML returned by flash.utils.describeType
internally.
Property | Defined 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 |
Method | Defined By | ||
---|---|---|---|
[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 | ||
[static]
Returns an instance representing the class or interface with the specified name. | ClassInfo | ||
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 | ||
getInterfaces():Array
Returns all interfaces implemented by the class
represented by this ClassInfo instance. | ClassInfo | ||
getMetadata(type:Object, validate:Boolean = true):Array
Returns all metadata tags for the specified type for this element. | MetadataAware | ||
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 | ||
getProperties():Array
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 | ||
getStaticMethods():Array
Returns Method instances for all public, static methods of this class. | ClassInfo | ||
getStaticProperties():Array
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 | ||
getSuperClass():Class
Returns the superclass of the class represented by this ClassInfo instance. | ClassInfo | ||
getSuperClasses():Array
Returns all superclasses or superinterfaces of the class or interface
represented by this ClassInfo instance. | ClassInfo | ||
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 | ||
[static] | ClassInfo |
Constant | Defined By | ||
---|---|---|---|
currentDomain : ApplicationDomain [static]
The ApplicationDomain to be used when no domain was explicitly specified. | ClassInfo |
applicationDomain | property |
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.
public function get applicationDomain():ApplicationDomain
cache | property |
cache:ReflectionCache
The reflection cache which keeps references to all ClassInfo instances created by the three static methods of this class.
public static function get cache():ReflectionCache
public static function set cache(value:ReflectionCache):void
name | property |
name:String
[read-only] The fully qualified class name for this instance.
public function get name():String
simpleName | property |
simpleName:String
[read-only] The non qualified class name for this instance.
public function get simpleName():String
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
|
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 )
|
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
|
ClassInfo — an instance representing the class or interface with the specified name
|
ReferenceError — if the class with the specified name does not exist
|
getClass | () | method |
public function getClass():Class
Returns the class this instance represents.
ReturnsClass — the class this instance represents
|
getConstructor | () | method |
public function getConstructor():Constructor
Returns the constructor for this class. This method will return null for interfaces.
ReturnsConstructor — the constructor for this class
|
getInterfaces | () | method |
public function getInterfaces():Array
Returns all interfaces implemented by the class represented by this ClassInfo instance.
ReturnsArray — 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
|
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.
ReturnsArray — 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.
ReturnsArray — 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
|
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
|
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
ReturnsArray |
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.
ReturnsArray — 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
|
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.
ReturnsClass — 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.
ReturnsArray — 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.
ReturnsBoolean — 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 |
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
|
Object — a new instance of the class represented by this ClassInfo instance
|
purgeCache | () | method |
public static function purgeCache(domain:ApplicationDomain = null):void
Parameters
domain:ApplicationDomain (default = null )
|
resolve | () | method |
public static function resolve(name:String, domain:ApplicationDomain):ClassInfo
Parameters
name:String | |
domain:ApplicationDomain |
ClassInfo |
currentDomain | Constant |
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.