public SerializationContext get() { // Threadlocal SerializationContent SerializationContext serializationContext = SerializationContext .getSerializationContext(); serializationContext.enableSmallMessages = true; serializationContext.instantiateTypes = true; // use _remoteClass field serializationContext.supportRemoteClass = true; // false Legacy Flex 1.5 behavior was to return a java.util.Collection // for Array, New Flex 2+ behavior is to return Object[] for AS3 Array serializationContext.legacyCollection = false; // false Legacy flash.xml.XMLDocument Type serializationContext.legacyMap = false; // true New E4X XML Type serializationContext.legacyXMLDocument = false; // determines whether the constructed Document is name-space aware serializationContext.legacyXMLNamespaces = false; serializationContext.legacyThrowable = false; serializationContext.legacyBigNumbers = false; serializationContext.restoreReferences = false; serializationContext.logPropertyErrors = false; serializationContext.ignorePropertyErrors = true; return serializationContext; } }
protected void clearThreadLocals() { SerializationContext.clearThreadLocalObjects(); TypeMarshallingContext.clearThreadLocalObjects(); }
/** {@inheritDoc} */ public Class getType(Object instance, String propertyName) { if (instance == null || propertyName == null) return null; BeanProperty bp = getBeanProperty(instance, propertyName); if (bp != null) { return bp.getType(); } return null; }
protected void setCloneFieldsFrom(AbstractProxy source) { setDescriptor(source.getDescriptor()); setDefaultInstance(source.getDefaultInstance()); context = source.context; includeReadOnly = source.includeReadOnly; } }
/** * Return true if this property is write only, which means we cannot get a value for it. * * @param instance the instance * @param propertyName the property name * @return true if there is a way to write but not read the property */ public boolean isWriteOnly(Object instance, String propertyName) { if (instance == null || propertyName == null) return false; BeanProperty bp = getBeanProperty(instance, propertyName); return bp != null && bp.isWrite() && !bp.isRead(); }
/** * Returns the backing Array of the <tt>ArrayCollection</tt>. * * @return The backing Array. */ public Object[] getSource() { return toArray(); }
protected void increaseNestObjectLevel() { nestObjectLevel++; if (nestObjectLevel > context.maxObjectNestLevel) { SerializationException se = new SerializationException(); se.setMessage(10315, new Object[] {context.maxObjectNestLevel}); throw se; } }
/** {@inheritDoc} */ public List getPropertyNames() { return getPropertyNames(getDefaultInstance()); }
/** {@inheritDoc} */ public Object getValue(String propertyName) { return getValue(getDefaultInstance(), propertyName); }
/** * Destroy thread local storage. * Call ONLY on shutdown. */ public static void releaseThreadLocalObjects() { clearThreadLocalObjects(); contexts = null; } }
/** {@inheritDoc} */ public String getAlias(Object instance) { return getClassName(instance); }
/** {@inheritDoc} */ public boolean getIncludeReadOnly() { if (includeReadOnly) { return true; } return getSerializationContext().includeReadOnly; }
/** {@inheritDoc} */ public Object clone() { return super.clone(); }
public ThrowableProxy(Throwable defaultInstance) { super(defaultInstance); setIncludeReadOnly(true); } }
/** * */ public void clearThreadLocals() { SerializationContext.clearThreadLocalObjects(); TypeMarshallingContext.clearThreadLocalObjects(); }
protected Object deSerializeObjectFromStream(ByteArrayInputStream bis) throws Exception { AMFDeSerializer serializer = new AMFDeSerializer(SerializationContext .getSerializationContext()); Object o = null; try { // do the deserialization. o = serializer.fromAmf(bis); LOG.trace("Serialized object: {}",o); bis.close(); } catch (IOException e) { LOG.error("IO error in AMF3ToJavaObjectDecoder: {}",e); throw e; } catch (ClassNotFoundException e) { LOG.error("Error in AMF3ToJavaObjectDecoder: {}.\n " + "Check if flash class has corresponding java class",e); throw e; } return o; } }
/** {@inheritDoc} */ public Class getType(Object instance, String propertyName) { if (instance == null || propertyName == null) return null; BeanProperty bp = getBeanProperty(instance, propertyName); return bp == null? null : bp.getType(); }
protected void increaseNestCollectionLevel() { nestCollectionLevel++; if (nestCollectionLevel > context.maxCollectionNestLevel) { SerializationException se = new SerializationException(); se.setMessage(10316, new Object[] {context.maxCollectionNestLevel}); throw se; } }
/** * */ public void clearThreadLocals() { SerializationContext.clearThreadLocalObjects(); TypeMarshallingContext.clearThreadLocalObjects(); }
/** {@inheritDoc} */ public Class getType(Object instance, String propertyName) { if (instance == null || propertyName == null) return null; BeanProperty bp = getBeanProperty(instance, propertyName); return bp == null? null : bp.getType(); }