public class DefaultObjectSerializationDelegate extends AbstractSerializationDelegate<java.lang.Object>
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
elementName |
protected static java.util.Map<java.lang.Class,com.inductiveautomation.ignition.common.xmlserialization.serialization.DefaultObjectSerializationDelegate.EqualityDelegate> |
equalityDelegates |
protected static DescriptorComparator |
propertyComparator |
protected boolean |
skipReferenceTracking |
static java.lang.String |
TRANSIENT_KEY
Key for a PropertyDescriptor to mark itself transient.
|
Constructor and Description |
---|
DefaultObjectSerializationDelegate()
Creates an object serializer that uses the default no-arg constructor
|
DefaultObjectSerializationDelegate(boolean ctorOnly,
java.lang.String... properties) |
DefaultObjectSerializationDelegate(java.lang.Class[] types,
java.lang.String[] properties)
Uses the constructor that accepts the given properties as arguments.
|
DefaultObjectSerializationDelegate(java.lang.String... properties)
Uses the constructor that accepts the given properties as arguments.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doProperty(XMLSerializationContext context,
Element elm,
java.beans.PropertyDescriptor pd,
java.lang.Object obj,
java.lang.Object clean)
Serializes the given property to the stream
|
protected void |
initConstructorTypes(java.lang.Class clazz) |
boolean |
isConstructorOnly() |
boolean |
isSkipReferenceTracking() |
protected boolean |
isTransient(java.beans.PropertyDescriptor pd) |
static boolean |
safeArrayEquals(java.lang.Object[] a,
java.lang.Object[] a2) |
static boolean |
safeEquals(java.lang.Object foo,
java.lang.Object bar)
equals that uses null-safe equality (null==null: true) and the delegates to the equalityDelegates if
there is one registered for the argument class.
|
Element |
serialize(XMLSerializationContext context,
java.lang.Object obj) |
protected Element |
serializeConstructor(XMLSerializationContext context,
java.lang.Object obj)
Gathers up the values for the properties named for an explicit constructor call, and then writes the call to the
constructor
|
protected void |
serializeProperties(XMLSerializationContext context,
Element elm,
java.lang.Object obj)
Runs through the javabean properties of the given object, and comares the values of each property to the value
that a clean copy of the object would have.
|
void |
setConstructorOnly(boolean constructorOnly) |
void |
setSkipReferenceTracking(boolean skipReferenceTracking) |
protected Element |
startObject(XMLSerializationContext context,
java.lang.Object obj)
Creates an Element with this delegate's element name and with the "cls" attribute set to the object's class.
|
protected Element |
writeCall(XMLSerializationContext context,
java.lang.reflect.Method method,
java.lang.Object... args) |
protected Element |
writeCall(XMLSerializationContext context,
java.lang.String methodName,
java.lang.Class[] argTypes,
java.lang.Object... args)
Writes an <o:c> element, which represents a call to a method.
|
protected Element |
writeConstructor(XMLSerializationContext context,
java.lang.Class[] types,
java.lang.Object[] args) |
public static final java.lang.String TRANSIENT_KEY
protected static DescriptorComparator propertyComparator
protected java.lang.String elementName
protected boolean skipReferenceTracking
protected static java.util.Map<java.lang.Class,com.inductiveautomation.ignition.common.xmlserialization.serialization.DefaultObjectSerializationDelegate.EqualityDelegate> equalityDelegates
public DefaultObjectSerializationDelegate()
public DefaultObjectSerializationDelegate(java.lang.String... properties)
public DefaultObjectSerializationDelegate(boolean ctorOnly, java.lang.String... properties)
public DefaultObjectSerializationDelegate(java.lang.Class[] types, java.lang.String[] properties)
public static boolean safeEquals(java.lang.Object foo, java.lang.Object bar)
public static boolean safeArrayEquals(java.lang.Object[] a, java.lang.Object[] a2)
protected Element writeCall(XMLSerializationContext context, java.lang.reflect.Method method, java.lang.Object... args) throws SerializationException
SerializationException
protected Element writeCall(XMLSerializationContext context, java.lang.String methodName, java.lang.Class[] argTypes, java.lang.Object... args) throws SerializationException
SerializationException
protected boolean isTransient(java.beans.PropertyDescriptor pd)
protected void doProperty(XMLSerializationContext context, Element elm, java.beans.PropertyDescriptor pd, java.lang.Object obj, java.lang.Object clean) throws java.lang.Exception
java.lang.Exception
protected void serializeProperties(XMLSerializationContext context, Element elm, java.lang.Object obj) throws SerializationException
context
- obj
- checkRef
- java.io.IOException
SerializationException
protected Element startObject(XMLSerializationContext context, java.lang.Object obj) throws SerializationException
SerializationException
public Element serialize(XMLSerializationContext context, java.lang.Object obj) throws SerializationException
SerializationException
protected Element serializeConstructor(XMLSerializationContext context, java.lang.Object obj) throws SerializationException
SerializationException
protected Element writeConstructor(XMLSerializationContext context, java.lang.Class[] types, java.lang.Object[] args) throws SerializationException
SerializationException
protected void initConstructorTypes(java.lang.Class clazz) throws SerializationException
SerializationException
public boolean isConstructorOnly()
public void setConstructorOnly(boolean constructorOnly)
public boolean isSkipReferenceTracking()
isSkipReferenceTracking
in interface SerializationDelegate<java.lang.Object>
isSkipReferenceTracking
in class AbstractSerializationDelegate<java.lang.Object>
public void setSkipReferenceTracking(boolean skipReferenceTracking)