jp.develop.common.util.amf.encoder
Class MapArrayEncoder

java.lang.Object
  extended by jp.develop.common.util.amf.encoder.MapArrayEncoder
All Implemented Interfaces:
IEncoder<Map<String,Object>>, IEncoder.IArrayEncoder<Map<String,Object>>

public class MapArrayEncoder
extends Object
implements IEncoder<Map<String,Object>>, IEncoder.IArrayEncoder<Map<String,Object>>

Implementation of IEncoder.IArrayEncoder for writing Map instance as Array.

Author:
Waki Takeya
See Also:
IEncoder, IEncoder.IArrayEncoder

Nested Class Summary
 
Nested classes/interfaces inherited from interface jp.develop.common.util.amf.encoder.IEncoder
IEncoder.IArrayEncoder<T>, IEncoder.IDictionaryEncoder<T>, IEncoder.IObjectEncoder<T>
 
Constructor Summary
MapArrayEncoder()
           
 
Method Summary
 void encode(AmfEncoder encoder, Map<String,Object> object)
          Encode to Action Message Format(AMF).
 int getArraySize(Map<String,Object> object)
          Get the size of array.
 Iterator<Object> getIterator(Map<String,Object> object)
          Get the iterator of specified array.
 Map<String,Object> getProperties(Map<String,Object> object)
          Get the properties of specified array.
 Object getValue(Map<String,Object> object, int index)
          Get the value of specified index.
 boolean isRandomAccess(Map<String,Object> object)
          Is this random access array?
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapArrayEncoder

public MapArrayEncoder()
Method Detail

encode

public void encode(AmfEncoder encoder,
                   Map<String,Object> object)
            throws IOException
Encode to Action Message Format(AMF).

Specified by:
encode in interface IEncoder<Map<String,Object>>
Parameters:
encoder - AMF encoder.
object - Object to be encoded.
Throws:
IOException - I/O Exception.

getArraySize

public int getArraySize(Map<String,Object> object)
Get the size of array.

Specified by:
getArraySize in interface IEncoder.IArrayEncoder<Map<String,Object>>
Parameters:
object - Array to be encoded.
Returns:
The size of array.

isRandomAccess

public boolean isRandomAccess(Map<String,Object> object)
Is this random access array?

Specified by:
isRandomAccess in interface IEncoder.IArrayEncoder<Map<String,Object>>
Returns:
true, if random access is available.

getIterator

public Iterator<Object> getIterator(Map<String,Object> object)
Get the iterator of specified array. If it is random access array, this method is not required to be implemented.

Specified by:
getIterator in interface IEncoder.IArrayEncoder<Map<String,Object>>
Parameters:
object - Array to be encoded.
Returns:
Iterator of specified array.

getValue

public Object getValue(Map<String,Object> object,
                       int index)
Get the value of specified index. If it is not random access array, this method is not required to be implemented.

Specified by:
getValue in interface IEncoder.IArrayEncoder<Map<String,Object>>
Parameters:
object - Array to be encoded.
index - Target index.
Returns:
The value of specified index.

getProperties

public Map<String,Object> getProperties(Map<String,Object> object)
Get the properties of specified array. This is for associative portion.

Specified by:
getProperties in interface IEncoder.IArrayEncoder<Map<String,Object>>
Returns:
Properties of specified array. Null means that there is no property.