flex.messaging.io.amf
Class ASObject

java.lang.Object
  extended by java.util.AbstractMap
      extended by java.util.HashMap
          extended by flex.messaging.io.amf.ASObject
All Implemented Interfaces:
Serializable, Cloneable, Map

public class ASObject
extends HashMap

This class represents a Flash Actionscript Object (typed or untyped)

Making a class rather than just deserializing to a HashMap was chosen for the following reasons:
1) "types" are not going to be native to Hashmap, table, etc.
2) it helps in making the deserializer/serializer reflexive.

See Also:
Serialized Form

Constructor Summary
ASObject()
          Create an Actionscript object.
ASObject(String name)
          Create a named Actionscript object.
 
Method Summary
 String getType()
          get the named type, if any.
 int hashCode()
          Return the hashcode of this object.
 void setType(String type)
          Sets the named type.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals
 

Constructor Detail

ASObject

public ASObject()
Create an Actionscript object.


ASObject

public ASObject(String name)
Create a named Actionscript object.

Parameters:
name - the type of the object
Method Detail

getType

public String getType()
get the named type, if any. (otherwise, return null, implying it is unnamed).

Returns:
the type.

setType

public void setType(String type)
Sets the named type.
This operation is mostly meaningless on an object that came in off the wire, but will be helpful for objects that will be serialized out to Flash.

Parameters:
type - the type of the object.

hashCode

public int hashCode()
Return the hashcode of this object. The hashcode is defined to be the sum of the hashcodes of each entry.

Specified by:
hashCode in interface Map
Overrides:
hashCode in class AbstractMap
Returns:

toString

public String toString()
Returns a string representation of this object. The string representation consists of a list of key-value mappings in the order returned by the map's entrySet view's iterator, enclosed in braces ("{}"). Adjacent mappings are separated by the characters ", " (comma and space). Each key-value mapping is rendered as the key followed by an equals sign ("=") followed by the associated value. Keys and values are converted to strings as by String.valueOf(Object).

This implementation creates an empty string buffer, appends a left brace, and iterates over the map's entrySet view, appending the string representation of each map.entry in turn. After appending each entry except the last, the string ", " is appended. Finally a right brace is appended. A string is obtained from the stringbuffer, and returned.

If the value is found to be recursive, "..." (three periods) are printed to indicate the loop.

Overrides:
toString in class AbstractMap
Returns:
a String representation of this map.


Copyright © 2008 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/io/amf/ASObject.html