/**
* @exclude
*/
protected void writeCustomObject(Object o) throws IOException
{
PropertyProxy proxy = null;
if (o instanceof PropertyProxy)
{
proxy = (PropertyProxy)o;
o = proxy.getDefaultInstance();
// The proxy may wrap a null default instance, if so, short circuit here.
if (o == null)
{
writeAMFNull();
return;
}
// HACK: Short circuit and unwrap if PropertyProxy is wrapping an Array
// or Collection type since we don't yet have the ability to proxy multiple
// AMF types. We write an AMF Array directly instead of an AMF Object
else if (o instanceof Collection)
{
if (context.legacyCollection)
writeCollection((Collection)o, proxy.getDescriptor());
else
writeArrayCollection((Collection)o, proxy.getDescriptor());
return;
}
else if (o.getClass().isArray())
{
writeObjectArray((Object[])o, proxy.getDescriptor());
return;
}
else if (context.legacyMap && o instanceof Map && !(o instanceof ASObject))
{
writeMapAsECMAArray((Map)o);