Class DefaultObjectSerializationDelegate
java.lang.Object
com.inductiveautomation.ignition.common.xmlserialization.serialization.AbstractSerializationDelegate<Object>
com.inductiveautomation.ignition.common.xmlserialization.serialization.DefaultObjectSerializationDelegate
- All Implemented Interfaces:
SerializationDelegate<Object>
- Direct Known Subclasses:
BasicTranslationPackageDelegate
,BorderUIResourceDelegate
,DefaultComponentDelegate
,InteractionDescriptorDelegate
,ListDelegate
,LocaleDelegate
,MapDelegate
,ProjectTagDelegate
,PyStringDelegate
,SetDelegate
,ShapeComponentDelegate
,TagEventScriptsDelegate
,WindowDelegate
An implementation of SerializationDelegate that uses reflection and the JavaBean standard to try and serialize any
arbitrary object
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected static DescriptorComparator
protected boolean
static final String
Key for a PropertyDescriptor to mark itself transient. -
Constructor Summary
ConstructorsConstructorDescriptionCreates an object serializer that uses the default no-arg constructorDefaultObjectSerializationDelegate
(boolean ctorOnly, String... properties) DefaultObjectSerializationDelegate
(Class[] types, String[] properties) Uses the constructor that accepts the given properties as arguments.DefaultObjectSerializationDelegate
(String... properties) Uses the constructor that accepts the given properties as arguments. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doProperty
(XMLSerializationContext context, Element elm, PropertyDescriptor pd, Object obj, Object clean) Serializes the given property to the streamprotected void
initConstructorTypes
(Class clazz) boolean
boolean
protected boolean
serialize
(XMLSerializationContext context, Object obj) protected Element
serializeConstructor
(XMLSerializationContext context, Object obj) Gathers up the values for the properties named for an explicit constructor call, and then writes the call to the constructorprotected void
serializeProperties
(XMLSerializationContext context, Element elm, 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, 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, Method method, Object... args) protected Element
writeCall
(XMLSerializationContext context, String methodName, Class[] argTypes, Object... args) Writes an <o:c> element, which represents a call to a method.protected Element
writeConstructor
(XMLSerializationContext context, Class[] types, Object[] args)
-
Field Details
-
TRANSIENT_KEY
Key for a PropertyDescriptor to mark itself transient. Value should be Boolean.TRUE- See Also:
-
propertyComparator
-
elementName
-
skipReferenceTracking
protected boolean skipReferenceTracking
-
-
Constructor Details
-
DefaultObjectSerializationDelegate
public DefaultObjectSerializationDelegate()Creates an object serializer that uses the default no-arg constructor -
DefaultObjectSerializationDelegate
Uses the constructor that accepts the given properties as arguments. This version creates a constructor-only serialization delegate. -
DefaultObjectSerializationDelegate
-
DefaultObjectSerializationDelegate
Uses the constructor that accepts the given properties as arguments. This constructor explicitly defines the types of the arguments accepted by the constructor in cases where it might be ambiguous.
-
-
Method Details
-
writeCall
protected Element writeCall(XMLSerializationContext context, Method method, Object... args) throws SerializationException - Throws:
SerializationException
-
writeCall
protected Element writeCall(XMLSerializationContext context, String methodName, Class[] argTypes, Object... args) throws SerializationException Writes an <o:c> element, which represents a call to a method.- Throws:
SerializationException
-
isTransient
-
doProperty
protected void doProperty(XMLSerializationContext context, Element elm, PropertyDescriptor pd, Object obj, Object clean) throws Exception Serializes the given property to the stream- Throws:
Exception
-
serializeProperties
protected void serializeProperties(XMLSerializationContext context, Element elm, Object obj) throws SerializationException 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. Serializes all properties that have a dirty value.- Throws:
SerializationException
-
startObject
protected Element startObject(XMLSerializationContext context, Object obj) throws SerializationException Creates an Element with this delegate's element name and with the "cls" attribute set to the object's class.- Throws:
SerializationException
-
serialize
- Throws:
SerializationException
-
serializeConstructor
protected Element serializeConstructor(XMLSerializationContext context, Object obj) throws SerializationException Gathers up the values for the properties named for an explicit constructor call, and then writes the call to the constructor- Throws:
SerializationException
-
writeConstructor
protected Element writeConstructor(XMLSerializationContext context, Class[] types, Object[] args) throws SerializationException - Throws:
SerializationException
-
initConstructorTypes
- Throws:
SerializationException
-
isConstructorOnly
public boolean isConstructorOnly() -
setConstructorOnly
public void setConstructorOnly(boolean constructorOnly) -
isSkipReferenceTracking
public boolean isSkipReferenceTracking()- Specified by:
isSkipReferenceTracking
in interfaceSerializationDelegate<Object>
- Overrides:
isSkipReferenceTracking
in classAbstractSerializationDelegate<Object>
-
setSkipReferenceTracking
public void setSkipReferenceTracking(boolean skipReferenceTracking)
-