Packageorg.granite.reflect
Classpublic class Annotation
InheritanceAnnotation Inheritance DescribedElement

Represents an ActionScript 3 annotation (or metadata) with all its arguments.

See also

AnnotedElement


Public Properties
 PropertyDefined by
  annotatedElement : IAnnotatedElement
[read-only] The IAnnotatedElement (class, variable, method, etc.) to which this annotation is attached.
Annotation
  args : Array
[read-only] An array of Arg instances that contains all arguments of this annotation.
Annotation
 InheriteddeclaredBy : Type
The Type instance this described element belongs to.
DescribedElement
  name : String
[read-only] The name of this annotation.
Annotation
Public Methods
 MethodDefined by
  
Annotation(annotatedElement:IAnnotatedElement, desc:XML)
Constructs a new Annotation instance.
Annotation
 Inherited
equals(o:*):Boolean
Tells if this DescribedElement instance is equal to the supplied o parameter.
DescribedElement
  
getArgValue(key:String = "", defaultValue:String = null):String
Returns the value of the first argument of this annotation whose key is equal to the supplied parameter.
Annotation
  
getArgValues(key:String):Array
Returns an array that contains all values of the arguments of this annotation whose key is equal to the supplied parameter.
Annotation
  
isArgPresent(key:String = ""):Boolean
Tests if this annotation has an argument whose key is equal to the supplied parameter.
Annotation
 Inherited
toString():String
Returns the a string (XML) representation of this described element.
DescribedElement
Property detail
annotatedElementproperty
annotatedElement:IAnnotatedElement  [read-only]

The IAnnotatedElement (class, variable, method, etc.) to which this annotation is attached.

Implementation
    public function get annotatedElement():IAnnotatedElement
argsproperty 
args:Array  [read-only]

An array of Arg instances that contains all arguments of this annotation.

Implementation
    public function get args():Array

See also

Arg
nameproperty 
name:String  [read-only]

The name of this annotation.

Implementation
    public function get name():String
Constructor detail
Annotation()constructor
public function Annotation(annotatedElement:IAnnotatedElement, desc:XML)

Constructs a new Annotation instance.

Parameters
annotatedElement:IAnnotatedElement — the element (class, variable, method, etc.) to which this annotation is attached.
 
desc:XML — the XML description of this annotation.
Method detail
getArgValue()method
public function getArgValue(key:String = "", defaultValue:String = null):String

Returns the value of the first argument of this annotation whose key is equal to the supplied parameter.

Parameters
key:String (default = "") — the key (or name) of the argument to get value from ("" for the default argument).
 
defaultValue:String (default = null) — the value to be returned if this annotation has no such argument.

Returns
String — the argument value, or defaultValue if this annotation has no such argument.
getArgValues()method 
public function getArgValues(key:String):Array

Returns an array that contains all values of the arguments of this annotation whose key is equal to the supplied parameter.

Parameters
key:String — key (or name) of the argument to get value from.

Returns
Array — the argument value, or null if this annotation has no such argument.
isArgPresent()method 
public function isArgPresent(key:String = ""):Boolean

Tests if this annotation has an argument whose key is equal to the supplied parameter.

Parameters
key:String (default = "") — key (or name) of the argument to check for ("" for the default argument).

Returns
Booleantrue if this annotation holds an argurment with this name, false otherwise.