/**
* Deserialize the bits of a map w/o a prefixing type byte.
*/
protected Object readObjectValue(String className) throws ClassNotFoundException, IOException
{
PropertyProxy proxy = null;
Object object;
// Check for any registered class aliases
String aliasedClass = ClassAliasRegistry.getRegistry().getClassName(className);
if (aliasedClass != null)
className = aliasedClass;
if (className == null || className.length() == 0)
{
object = new ASObject();
}
else if (className.startsWith(">")) // Handle [RemoteClass] (no server alias)
{
object = new ASObject();
((ASObject)object).setType(className);
}
else if (context.instantiateTypes || className.startsWith("flex."))
{
Class desiredClass = AbstractProxy.getClassFromClassName(className, context.createASObjectForMissingType);
proxy = PropertyProxyRegistry.getRegistry().getProxyAndRegister(desiredClass);
if (proxy == null)
object = ClassUtil.createDefaultInstance(desiredClass, null);
else
object = proxy.createInstance(className);
}
else
{
// Just return type info with an ASObject...
object = new ASObject();
((ASObject)object).setType(className);
}
if (proxy == null)
proxy = PropertyProxyRegistry.getProxyAndRegister(object);
int objectId = rememberObject(object);
if (isDebug)
trace.startAMFObject(className, objectsTable.size() - 1);
String propertyName = in.readUTF();
int type = in.readByte();
while (type != kObjectEndType)
{
if (isDebug)
trace.namedElement(propertyName);
Object value = readObjectValue(type);
proxy.setValue(object, propertyName, value);
propertyName = in.readUTF();
type = in.readByte();
}
if (isDebug)
trace.endAMFObject();
// This lets the BeanProxy substitute a new instance into the BeanProxy
// at the end of the serialization. You might for example create a Map, store up
// the properties, then construct the instance based on that. Note that this does
// not support recursive references to the parent object however.
Object newObj = proxy.instanceComplete(object);
// TODO: It is possible we gave out references to the
// temporary object. it would be possible to warn users about
// that problem by tracking if we read any references to this object
// in the readObject call above.