Packageflex.lang.reflect
Classpublic class Field
InheritanceField Inheritance Object

An object representing a property or variable of a class or instance. You can gain access to the value of the field as well as inspect its metadata.



Public Properties
 PropertyDefined By
  definedBy : Class
[read-only] Returns the Class that defines this field.
Field
  elementType : Class
[read-only] Retrieves the element type of the Field
Field
  isProperty : Boolean
[read-only] Returns whether the Field is a property.
Field
  isStatic : Boolean
[read-only] Returns whether the Field is static.
Field
  metadata : Array
[read-only] Retrieves an array of MetaDataAnnotation instances associated with the Field
Field
  name : String
[read-only] Retrieves the name of the Field
Field
  type : Class
[read-only] Retrieves the Class associated with the Field
Field
Public Methods
 MethodDefined By
  
Field(fieldXML:XML, isStatic:Boolean, definedBy:Class, isProperty:Boolean)
Field Constructor
Field
  
equals(item:Field):Boolean
Compares two Field instances for equality
Field
  
Returns the MetaDataAnnotation associated with a given annotation using the annotation's name
Field
  
getObj(obj:Object = null):Object
Retrieves the actual field represented by this Field object within the instance or class where it exists.
Field
  
hasMetaData(name:String):Boolean
Checks for the existance of a metadata annotation using the annotation's name
Field
Property Detail
definedByproperty
definedBy:Class  [read-only]

Returns the Class that defines this field.


Implementation
    public function get definedBy():Class
elementTypeproperty 
elementType:Class  [read-only]

Retrieves the element type of the Field


Implementation
    public function get elementType():Class
isPropertyproperty 
isProperty:Boolean  [read-only]

Returns whether the Field is a property. Fields are either properties (getter/setters) or variables.


Implementation
    public function get isProperty():Boolean
isStaticproperty 
isStatic:Boolean  [read-only]

Returns whether the Field is static.


Implementation
    public function get isStatic():Boolean
metadataproperty 
metadata:Array  [read-only]

Retrieves an array of MetaDataAnnotation instances associated with the Field


Implementation
    public function get metadata():Array
nameproperty 
name:String  [read-only]

Retrieves the name of the Field


Implementation
    public function get name():String
typeproperty 
type:Class  [read-only]

Retrieves the Class associated with the Field


Implementation
    public function get type():Class
Constructor Detail
Field()Constructor
public function Field(fieldXML:XML, isStatic:Boolean, definedBy:Class, isProperty:Boolean)

Field Constructor

Parameters
fieldXML:XML — XML that describes the Field to be created
 
isStatic:Booleantrue if Field is static, else false
 
definedBy:ClassClass that defines the Field to be created
 
isProperty:Booleantrue if the Field is a property, else false
Method Detail
equals()method
public function equals(item:Field):Boolean

Compares two Field instances for equality

Parameters

item:Field

Returns
Boolean — Returns boolean indicating equality
getMetaData()method 
public function getMetaData(name:String):MetaDataAnnotation

Returns the MetaDataAnnotation associated with a given annotation using the annotation's name

Parameters

name:String — the name of the annotation

Returns
MetaDataAnnotation — the MetaDataAnnotation instance for the annotation name, or null if it was not found.
getObj()method 
public function getObj(obj:Object = null):Object

Retrieves the actual field represented by this Field object within the instance or class where it exists. If an object is passed, then this field is returned from that object instance. If a null argument is passed and the field is static, then the field is treated as static and returned from the class. If a null argument is passed and the field is NOT static, then an error is thrown.

Parameters

obj:Object (default = null) — An instance where the field exists

Returns
Object — The object represented by this Field within the specified object or class.
hasMetaData()method 
public function hasMetaData(name:String):Boolean

Checks for the existance of a metadata annotation using the annotation's name

Parameters

name:String — the name of the annotation

Returns
Boolean — Returns true if the annotation exists, false if it does not.

See also