API Documentation | All Packages | All Classes | Index | Frames No Frames |
MetaDataAnnotation

Package | flex.lang.reflect.metadata
Class | public class MetaDataAnnotation
Inheritance | MetaDataAnnotation Object

An object representing an annotation represented as a metadata tag, in the example [Test(arg="1")] Test is the annotation. You can interrogate the annotation's name and arguments.

Public Properties

| Property | Defined By
--- | --- | ---
|  | arguments : Array [read-only] Getter for retrieving an array of arguments specified for the metadata annotation. | MetaDataAnnotation
|  | defaultArgument : MetaDataArgument [read-only] Returns the first unpaired argument of an annotation. | MetaDataAnnotation
|  | name : String [read-only] Getter for retrieving the metadata annotation name. | MetaDataAnnotation

Public Methods

| Method | Defined By
--- | --- | ---
|  | MetaDataAnnotation(metaDataXML:XML) Constructor Parses nodes returned from a call to describeType to provide an object wrapper for annotations Expected format of the argument is | MetaDataAnnotation
|  | equals(item:MetaDataAnnotation):Boolean Compares two MetaDataAnnotations for name and argument equality | MetaDataAnnotation
|  | getArgument(key:String, caseInsensitive:Boolean = false):MetaDataArgument Returns the MetaDataArgument associated with a given argument using the argument's key | MetaDataAnnotation
|  | hasArgument(key:String, caseInsensitive:Boolean = false):Boolean Checks for the existance of a given argument within this annotation using the argument's key | MetaDataAnnotation

Protected Methods

| Method | Defined By
--- | --- | ---
|  | buildArguments():Array Builds an array of MetaDataArguments from metadata nodes | MetaDataAnnotation

Property Detail

arguments | property

`arguments:Array` [read-only]

Getter for retrieving an array of arguments specified for the metadata annotation. Given the following example [Test(async="true",expects="TypeError")] async="true" and expects="TypeError" are the arguments

Implementation
`public function get arguments():Array`

defaultArgument | property |

`defaultArgument:MetaDataArgument` [read-only]

Returns the first unpaired argument of an annotation. Given the following example [RunWith("org.flexunit.runners.Suite",order="1")] The default argument would be "org.flexunit.runners.Suite". This is often used with MetaData such as RunWith which expects to have a default value.

Implementation
`public function get defaultArgument():MetaDataArgument`

name | property |

`name:String` [read-only]

Getter for retrieving the metadata annotation name. Given the following example [Test(async='true',expects="TypeError")] Test is the annotation name.

Implementation
`public function get name():String`
Constructor Detail

MetaDataAnnotation | () | Constructor

`public function MetaDataAnnotation(metaDataXML:XML)`

Constructor Parses nodes returned from a call to `describeType` to provide an object wrapper for annotations Expected format of the argument is

Parameters

| `metaDataXML:XML` — XML node.

Method Detail

buildArguments | () | method

`protected function buildArguments():Array`

Builds an array of MetaDataArguments from metadata nodes

Returns

| `Array` — Returns an array containing MetaDataArgument instances.

equals | () | method |

`public function equals(item:MetaDataAnnotation):Boolean`

Compares two MetaDataAnnotations for name and argument equality

Parameters

| `item:MetaDataAnnotation`

Returns

| `Boolean` — Returns boolean indicating equality

getArgument | () | method |

`public function getArgument(key:String, caseInsensitive:Boolean = false):MetaDataArgument`

Returns the MetaDataArgument associated with a given argument using the argument's key

Parameters

| `key:String` — An argument key
| `caseInsensitive:Boolean` (default = `false`)`` — default false, if set to true, then the key is matched in a case insensitive manner.

Returns

| `MetaDataArgument` — the MetaDataArgument instance for the argument key, or null if it was not found.

hasArgument | () | method |

`public function hasArgument(key:String, caseInsensitive:Boolean = false):Boolean`

Checks for the existance of a given argument within this annotation using the argument's key

Parameters

| `key:String` — An argument key
| `caseInsensitive:Boolean` (default = `false`)`` — default false, if set to true, then the key is matched in a case insensitive manner.

Returns

| `Boolean` — Returns true if the key exists, false if it does not.

See also

getArgument()

Thu Apr 10 2014, 08:07 AM +10:00