Packageorg.granite.reflect
Classpublic class Method
InheritanceMethod Inheritance Parameterizable Inheritance Member Inheritance DescribedElement

Represents a method of an ActionScript 3 class.



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 method.
Method
 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
  returnType : Type
[read-only] The returned type of this method (may be Type.VOID or Type.WILD.
Method
  uri : String
[read-only] The namespace's uri of this method ("" for public methods).
Method
Public Methods
 MethodDefined by
  
Method(declaredBy:Type, desc:XML)
Constructs a new Method instance.
Method
 Inherited
equals(o:*):Boolean
Tells if this DescribedElement instance is equal to the supplied o parameter.
DescribedElement
  
getAnnotation(type:String, recursive:Boolean = false):Annotation
Returns the first Annotation whose name is equal to the supplied type parameter, attached to this IAnnotatedElement.
Method
  
getAnnotations(recursive:Boolean = false, pattern:String = "^_?[^_]"):Array
Returns an array (possibly empty) that contains all annotations attached to this IAnnotatedElement.
Method
  
invoke(instance:Object, ... args):*
Invokes the underlying method represented by this Method object, on the specified instance with the specified parameters.
Method
  
invokeWithArray(instance:Object, args:Array):*
Invokes the underlying method represented by this Method object, on the specified instance with the specified parameters.
Method
 Inherited
isAccessor():Boolean
Checks if this member is an accessor (get/set) field.
Member
  
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.
Method
 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
 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 method.

Implementation
    public function get name():String
returnTypeproperty 
returnType:Type  [read-only]

The returned type of this method (may be Type.VOID or Type.WILD.

Implementation
    public function get returnType():Type

See also

uriproperty 
uri:String  [read-only]

The namespace's uri of this method ("" for public methods).

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

Constructs a new Method instance.

The declaredBy parameter is adjusted in order to match the actual type that declares this method by using "declaredBy" attribute of its XML description. Hence, the returned value of the Method.declaredBy accessor may not return the declaredBy parameter value, but one of its superclasses.

Parameters
declaredBy:Type — the Type instance this method belongs to.
 
desc:XML — the XML description of the method.
Method detail
getAnnotation()method
public override function getAnnotation(type:String, recursive:Boolean = false):Annotation

Returns the first Annotation whose name is equal to the supplied type parameter, attached to this IAnnotatedElement.

Parameters
type:String — the name of the annotation to look for.
 
recursive:Boolean (default = false) — should we look for annotations attached to overridden elements (non-static accessors or methods) or superclasses/superinterfaces ?

Returns
Annotation — an Annotation instance or null if it cannot be found.
getAnnotations()method 
public override function getAnnotations(recursive:Boolean = false, pattern:String = "^_?[^_]"):Array

Returns an array (possibly empty) that contains all annotations attached to this IAnnotatedElement.

Parameters
recursive:Boolean (default = false) — should we look for annotations attached to overridden elements (non-static accessors or methods) or superclasses/superinterfaces ?
 
pattern:String (default = "^_?[^_]") — a regexp expression used as a filter. Default is to eliminate all annotations prefixed with a double '_' character. You may use this parameter to find all annotations with a specific name.

Returns
Array — an array that contains all annotations attached to this IAnnotatedElement.
invoke()method 
public function invoke(instance:Object, ... args):*

Invokes the underlying method represented by this Method object, on the specified instance with the specified parameters.

Parameters
instance:Object — the object the underlying method is invoked from (may be null for static methods).
 
... args — a variable list of arguments used for the method call.

Returns
* — the result of this method call or undefined undefined if the underlying method return type is void.

Throws
— if the instance parameter is not an instance of the class that declares this method, if the method is not static and the instance parameter is null, and whenever supplied argument count or types are not suitable.
 
InvocationTargetError — if the underlying function throws an error.
invokeWithArray()method 
public function invokeWithArray(instance:Object, args:Array):*

Invokes the underlying method represented by this Method object, on the specified instance with the specified parameters.

Parameters
instance:Object — the object the underlying method is invoked from (may be null for static methods).
 
args:Array — an array of arguments used for the method call.

Returns
* — the result of this method call or undefined undefined if the underlying method return type is void.

Throws
— if the instance parameter is not an instance of the class that declares this method, if the method is not static and the instance parameter is null, and whenever supplied argument count or types are not suitable.
 
InvocationTargetError — if the underlying function throws an error.
isAnnotationPresent()method 
public override function 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.

Parameters
type:String — the name of the annotation to look for.
 
recursive:Boolean (default = false) — should we look for annotations attached to overridden elements (non-static accessors or methods) or superclasses/superinterfaces ?

Returns
Booleantrue if the annotation can be found, false otherwise.