Packagesystem.data.iterators
Classpublic class ArrayFieldIterator
InheritanceArrayFieldIterator Inheritance ArrayIterator Inheritance Object

Converts an array to an iterator but this iterator return the value of a specific field if the array is an array of objects.

Example :

     import system.iterators.ArrayFieldIterator ;
     
     var ar:Array = 
     [
         { label : "item1", date : new Date(2005, 10, 12) } ,
         { label : "item2", date : new Date(2004, 2, 22) } ,
         { label : "item3", date : new Date(2005, 4, 3) }
     ] ;
     
     trace (" --- browse 'label' field") ;
     
     var it:ArrayFieldIterator = new ArrayFieldIterator(ar, "label") ;
     while (it.hasNext()) 
     {
         trace (it.next() + " : " + it.key()) ;
     }
     
     trace(" --- browse 'date' field") ;
     
     var it:ArrayFieldIterator = new ArrayFieldIterator(ar, "date") ;
     while (it.hasNext())
     {
         trace (it.next() + " : " + it.key()) ;
     }
     



Public Properties
 PropertyDefined By
  fieldName : String
The field used in the next method to return the next value in the array.
ArrayFieldIterator
  undefineable : * = null
The default undefineable value use if the field don't exist in the current object in the iterator.
ArrayFieldIterator
Protected Properties
 PropertyDefined By
 Inherited_a : Array
current array
ArrayIterator
 Inherited_k : Number
current key
ArrayIterator
Public Methods
 MethodDefined By
  
ArrayFieldIterator(a:Array, fieldName:String = null)
Creates a new ArrayFieldIterator instance.
ArrayFieldIterator
 Inherited
hasNext():Boolean
Returns true if the iteration has more elements.
ArrayIterator
 Inherited
key():*
Returns the current key of the internal pointer of the iterator (optional operation).
ArrayIterator
  
next():*
[override] Returns the next field element in the iteration.
ArrayFieldIterator
 Inherited
remove():*
Removes from the underlying collection the last element returned by the iterator (optional operation).
ArrayIterator
 Inherited
reset():void
Reset the internal pointer of the iterator (optional operation).
ArrayIterator
 Inherited
seek(position:*):void
Changes the position of the internal pointer of the iterator (optional operation).
ArrayIterator
Property Detail
fieldNameproperty
public var fieldName:String

The field used in the next method to return the next value in the array.

undefineableproperty 
public var undefineable:* = null

The default undefineable value use if the field don't exist in the current object in the iterator.

Constructor Detail
ArrayFieldIterator()Constructor
public function ArrayFieldIterator(a:Array, fieldName:String = null)

Creates a new ArrayFieldIterator instance.

Parameters
a:Array
 
fieldName:String (default = null)
Method Detail
next()method
override public function next():*

Returns the next field element in the iteration.

Returns
* — the next field element in the iteration.