Package flex.messaging.io

Examples of flex.messaging.io.PropertyProxy


    protected Object decodeTypedObject(Object bean, Object encodedObject)
    {
        TypeMarshallingContext context = TypeMarshallingContext.getTypeMarshallingContext();
        context.getKnownObjects().put(encodedObject, bean);

        PropertyProxy beanProxy = PropertyProxyRegistry.getProxy(bean);
        PropertyProxy encodedProxy = PropertyProxyRegistry.getProxy(encodedObject);

        List propertyNames = beanProxy.getPropertyNames(bean);
        if (propertyNames != null)
        {
            Iterator it = propertyNames.iterator();
            while (it.hasNext())
            {
                String propName = (String)it.next();

                Class wClass = beanProxy.getType(bean, propName);

                // get property value from encodedObject
                Object value = encodedProxy.getValue(encodedObject, propName);

                Object decodedObject = null;
                try
                {
                    if (value != null)
View Full Code Here


        return decodeTypedObject(bean, encodedObject);
    }

    protected Object decodeTypedObject(Object bean, Object encodedObject)
    {
        PropertyProxy beanProxy = PropertyProxyRegistry.getProxyAndRegister(bean);
        PropertyProxy encodedProxy = PropertyProxyRegistry.getProxyAndRegister(encodedObject);

        List propertyNames = beanProxy.getPropertyNames(bean);
        if (propertyNames != null)
        {
            Iterator it = propertyNames.iterator();
            while (it.hasNext())
            {
                String propName = (String)it.next();

                Class wClass = beanProxy.getType(bean, propName);

                // get property value from encodedObject
                Object value = encodedProxy.getValue(encodedObject, propName);

                Object decodedObject = null;
                try
                {
                    if (value != null)
View Full Code Here

                if (desc != null)
                    ac.setDescriptor(desc);
            }

            // Then wrap ArrayCollection in PropertyProxy for bean-like serialization
            PropertyProxy proxy = PropertyProxyRegistry.getProxy(ac);
            writePropertyProxy(proxy, ac);
        }
    }
View Full Code Here

    /**
     * @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 or Map with legacyMap as true 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);
View Full Code Here

                Object item = values[i];
                if (item != null && descriptor != null && !(item instanceof String)
                        && !(item instanceof Number) && !(item instanceof Boolean)
                        && !(item instanceof Character))
                {
                    PropertyProxy proxy = PropertyProxyRegistry.getProxy(item);
                    proxy = (PropertyProxy)proxy.clone();
                    proxy.setDescriptor(descriptor);
                    proxy.setDefaultInstance(item);
                    item = proxy;
                }
                writeObject(item);
            }
View Full Code Here

                if (item != null && descriptor != null && !(item instanceof String)
                        && !(item instanceof Number) && !(item instanceof Boolean)
                        && !(item instanceof Character))
                {
                    PropertyProxy proxy = PropertyProxyRegistry.getProxy(item);
                    proxy = (PropertyProxy)proxy.clone();
                    proxy.setDescriptor(descriptor);
                    proxy.setDefaultInstance(item);
                    item = proxy;
                }
                writeObject(item);

                i++;
View Full Code Here

        {
            TraitsInfo ti = readTraits(ref);
            String className = ti.getClassName();
            boolean externalizable = ti.isExternalizable();
            Object object;
            PropertyProxy proxy = null;

            // 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);

            // Remember our instance in the object table
            int objectId = objectTable.size();
            objectTable.add(object);

            if (externalizable)
            {
                readExternalizable(className, object);
            }
            else
            {
                if (isDebug)
                {
                    trace.startAMFObject(className, objectTable.size() - 1);
                }

                int len = ti.getProperties().size();

                for (int i = 0; i < len; i++)
                {
                    String propName = (String)ti.getProperty(i);

                    if (isDebug)
                        trace.namedElement(propName);

                    Object value = readObject();
                    proxy.setValue(object, propName, value);
                }

                if (ti.isDynamic())
                {
                    for (; ;)
                    {
                        String name = readString();
                        if (name == null || name.length() == 0) break;

                        if (isDebug)
                            trace.namedElement(name);

                        Object value = readObject();
                        proxy.setValue(object, name, value);
                    }
                }
            }

            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.
View Full Code Here

                if (desc != null)
                    ac.setDescriptor(desc);
            }

            // Then wrap ArrayCollection in PropertyProxy for bean-like serialization
            PropertyProxy proxy = PropertyProxyRegistry.getProxy(ac);
            writePropertyProxy(proxy, ac);
        }
    }
View Full Code Here

    /**
     * @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);
View Full Code Here

                if (item != null && descriptor != null && !(item instanceof String)
                        && !(item instanceof Number) && !(item instanceof Boolean)
                        && !(item instanceof Character))
                {

                    PropertyProxy proxy = PropertyProxyRegistry.getProxy(item);
                    proxy = (PropertyProxy)proxy.clone();
                    proxy.setDescriptor(descriptor);
                    item = proxy;
                }
                writeObject(item);
            }
View Full Code Here

TOP

Related Classes of flex.messaging.io.PropertyProxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.