php.java.bridge
Class PhpMap

java.lang.Object
  extended by php.java.bridge.PhpMap

abstract class PhpMap
extends java.lang.Object

Maps php iterator to java iterator.

Author:
jostb

Field Summary
(package private)  JavaBridge _bridge
           
(package private)  java.lang.Class componentType
           
(package private)  boolean keyType
           
(package private)  java.lang.Object value
           
 
Constructor Summary
protected PhpMap(JavaBridge bridge, java.lang.Object value, boolean keyType)
           
 
Method Summary
protected  java.lang.Object coerce(java.lang.Object val)
           
abstract  java.lang.Object currentData()
          Returns the object at the current position.
abstract  java.lang.Object currentKey()
          Returns the key at the current position.
static PhpMap getPhpMap(java.lang.Object value, JavaBridge bridge)
          Returns a PhpMap for a given value.
 boolean getType()
          Returns the key type.
abstract  boolean hasMore()
          Checks if it is possible to advance one element
protected abstract  void init()
           
abstract  boolean moveForward()
          Forward one element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_bridge

JavaBridge _bridge

value

java.lang.Object value

componentType

java.lang.Class componentType

keyType

boolean keyType
Constructor Detail

PhpMap

protected PhpMap(JavaBridge bridge,
                 java.lang.Object value,
                 boolean keyType)
Method Detail

coerce

protected java.lang.Object coerce(java.lang.Object val)

init

protected abstract void init()

currentData

public abstract java.lang.Object currentData()
Returns the object at the current position.

Returns:
The current object.

currentKey

public abstract java.lang.Object currentKey()
Returns the key at the current position.

Returns:
The current key, either a string or a number.

moveForward

public abstract boolean moveForward()
Forward one element.

Returns:
true if move was possible, false otherwise.

hasMore

public abstract boolean hasMore()
Checks if it is possible to advance one element

Returns:
true if next element exists, false otherwise

getType

public boolean getType()
Returns the key type.

Returns:
false if key is integer (array index), true if key is string (hash key)

getPhpMap

public static PhpMap getPhpMap(java.lang.Object value,
                               JavaBridge bridge)
Returns a PhpMap for a given value.

Parameters:
value - The value, must be an array or implement Map or Collection
bridge - The bridge instance
Returns:
The PhpMap