Packageorg.granite.reflect
Classpublic class Constructor
InheritanceConstructor Inheritance Parameterizable Inheritance Member Inheritance DescribedElement

Represents the constructor of a given Type.

Note: even if this class implements the IAnnotatedElement interface, annotations are not supported on ActionScript 3 constructors (language limitation) or not returned by flash.utils.describeType calls (reflection API limitation). All IAnnotatedElement methods will return empty, null or false results.



Public Properties
 PropertyDefined by
 Inheritedannotations : Array
An array that contains all annotations directly attached to this IAnnotatedElement.
Member
 InheriteddeclaredBy : Type
The Type instance this described element belongs to.
DescribedElement
  name : String
[read-only] The name of this constructor (always equal to the unqualified class name)
Constructor
 Inheritedns : Namespace
The namespace of this Member.
Member
 Inheritedparameters : Array
An array that contains all the parameters of this Parameterizable instance.
Parameterizable
 InheritedpropertyKey : String
The String representation of this member (field or method qName, key of a dynamic property or dictionary, index of an array, etc.)
Member
 InheritedqName : QName
The qualified name of this Member.
Member
  uri : String
[read-only] The uri of this constructor (always "" because constructors cannot use specific namespaces).
Constructor
Public Methods
 MethodDefined by
  
Constructor(declaredBy:Type, desc:XML)
Constructs a new Constructor instance.
Constructor
  
equals(o:*):Boolean
Constructor
 Inherited
getAnnotation(type:String, recursive:Boolean = false):Annotation
Returns the first Annotation whose name is equal to the supplied type parameter, attached to this IAnnotatedElement.
Member
 Inherited
getAnnotations(recursive:Boolean = false, pattern:String = "^_?[^_]"):Array
Returns an array (possibly empty) that contains all annotations attached to this IAnnotatedElement.
Member
 Inherited
isAccessor():Boolean
Checks if this member is an accessor (get/set) field.
Member
 Inherited
isAnnotationPresent(type:String, recursive:Boolean = false):Boolean
Tests if an Annotation, whose name is equal to the supplied type parameter, is attached to this IAnnotatedElement.
Member
 Inherited
isConstant():Boolean
Checks if this member is a constant field.
Member
 Inherited
isConstructor():Boolean
Checks if this member is a constructor.
Member
 Inherited
Checks if this member is a dynamic property (always false for Member, always true for DynamicProperty).
Member
 Inherited
isInNamespace(ns:Namespace):Boolean
Tells if this Member instance is declared in the the suplied ns namespace parameter.
Member
 Inherited
isMethod():Boolean
Checks if this member is a method.
Member
 Inherited
isReadable():Boolean
Checks if this member is readable (fields only).
Member
 Inherited
isStatic():Boolean
Checks if this member is static.
Member
 Inherited
isVariable():Boolean
Checks if this member is a variable field.
Member
 Inherited
isWriteable():Boolean
Checks if this member is writeable (fields only).
Member
  
newInstance(... args):*
Returns a new instance of this constructor's declaring class.
Constructor
  
newInstanceWithArray(args:Array):*
Returns a new instance of this constructor's declaring class.
Constructor
 Inherited
toString():String
Returns the a string (XML) representation of this described element.
DescribedElement
Property detail
nameproperty
name:String  [read-only]

The name of this constructor (always equal to the unqualified class name)

Implementation
    public function get name():String
uriproperty 
uri:String  [read-only]

The uri of this constructor (always "" because constructors cannot use specific namespaces).

Implementation
    public function get uri():String
Constructor detail
Constructor()constructor
public function Constructor(declaredBy:Type, desc:XML)

Constructs a new Constructor instance.

Parameters
declaredBy:Type — the Type instance this constructor belongs to.
 
desc:XML — the XML description of the constructor.
Method detail
equals()method
public override function equals(o:*):Boolean

Parameters
o:*

Returns
Boolean
newInstance()method 
public function newInstance(... args):*

Returns a new instance of this constructor's declaring class.

This is just a utility method, limited to 10 maximum arguments. It may be simpler and more powerful to call directly the constructor the following way:

   var myInstance:MyClass = new myType.getClass()(...);
Parameters
... args — a variable list of arguments to pass to the constructor call.

Returns
* — the new instance of this constructor's declaring class.

Throws
— if supplied arguments are not fulfilling the class constructor requirements (count or type) or if an array of more than 10 arguments is passed to this method.
 
InvocationTargetError — if the constructor has thrown an error.
newInstanceWithArray()method 
public function newInstanceWithArray(args:Array):*

Returns a new instance of this constructor's declaring class.

This is just a utility method, limited to 10 maximum arguments. It may be simpler and more powerful to call directly the constructor the following way:

   var myInstance:MyClass = new myType.getClass()(...);
Parameters
args:Array — an array of arguments to pass to the constructor call.

Returns
* — the new instance of this constructor's declaring class.

Throws
— if supplied arguments are not fulfilling the class constructor requirements (count or type) or if an array of more than 10 arguments is passed to this method.
 
InvocationTargetError — if the constructor has thrown an error.