src/main/java/com/mxgraph/io/mxObjectCodec.java
public Node encode(mxCodec enc, Object obj)
	{
		Node node = enc.document.createElement(getName());

		obj = beforeEncode(enc, obj, node);
		encodeObject(enc, obj, node);

		return afterEncode(enc, obj, node);
	}
/**
	 * Encodes the specified object and returns a node representing then given
	 * object. Calls beforeEncode after creating the node and afterEncode
	 * with the resulting node after processing.
	 * 
	 * Enc is a reference to the calling encoder. It is used to encode complex
	 * objects and create references.
	 * 
	 * This implementation encodes all variables of an object according to the
	 * following rules:
	 * 
	 * <ul>
	 * <li>If the variable name is in {@link #exclude} then it is ignored.</li>
	 * <li>If the variable name is in {@link #idrefs} then
	 * {@link mxCodec#getId(Object)} is used to replace the object with its ID.
	 * </li>
	 * <li>The variable name is mapped using {@link #mapping}.</li>
	 * <li>If obj is an array and the variable name is numeric (ie. an index) then it
	 * is not encoded.</li>
	 * <li>If the value is an object, then the codec is used to create a child
	 * node with the variable name encoded into the "as" attribute.</li>
	 * <li>Else, if {@link com.mxgraph.io.mxCodec#isEncodeDefaults()} is true or
	 * the value differs from the template value, then ...
	 * <ul>
	 * <li>... if obj is not an array, then the value is mapped to an
	 * attribute.</li>
	 * <li>... else if obj is an array, the value is mapped to an add child
	 * with a value attribute or a text child node, if the value is a function.
	 * </li>
	 * </ul>
	 * </li>
	 * </ul>
	 * 
	 * If no ID exists for a variable in {@link #idrefs} or if an object cannot be
	 * encoded, a warning is logged.
	 * 
	 * @param enc Codec that controls the encoding process.
	 * @param obj Object to be encoded.
	 * @return Returns the resulting XML node that represents the given object. 
	 */
Encodes the specified object and returns a node representing then given
object. Calls beforeEncode after creating the node and afterEncode
with the resulting node after processing.

Enc is a reference to the calling encoder. It is used to encode complex
objects and create references.

This implementation encodes all variables of an object according to the
following rules.


If the variable name is in  #exclude then it is ignored.
If the variable name is in  #idrefs then
mxCodec#getId(Object) is used to replace the object with its ID.

The variable name is mapped using  #mapping.
If obj is an array and the variable name is numeric  then it
is not encoded.
If the value is an object, then the codec is used to create a child
node with the variable name encoded into the "as" attribute.
Else, if  com.mxgraph.io.mxCodec#isEncodeDefaults() is true or
the value differs from the template value, then

... if obj is not an array, then the value is mapped to an
attribute.
... else if obj is an array, the value is mapped to an add child
with a value attribute or a text child node, if the value is a function.

If no ID exists for a variable in  #idrefs or if an object cannot be
encoded, a warning is logged.

@param enc Codec that controls the encoding process.
@param obj Object to be encoded.
@return Returns the resulting XML node that represents the given object.
Encodes the specified object and returns a node representing then given object . Calls beforeEncode after creating the node and afterEncode with the resulting node after processing . Enc is a reference to the calling encoder . It is used to encode complex objects and create references . This implementation encodes all variables of an object according to the following rules . If the variable name is in #exclude then it is ignored . If the variable name is in #idrefs then mxCodec#getId ( Object ) is used to replace the object with its ID . The variable name is mapped using #mapping . If obj is an array and the variable name is numeric then it is not encoded . If the value is an object then the codec is used to create a child node with the variable name encoded into the " as " attribute . Else if com . mxgraph . io . mxCodec#isEncodeDefaults () is true or the value differs from the template value then ... if obj is not an array then the value is mapped to an attribute . ... else if obj is an array the value is mapped to an add child with a value attribute or a text child node if the value is a function . If no ID exists for a variable in #idrefs or if an object cannot be encoded a warning is logged . @param enc Codec that controls the encoding process . @param obj Object to be encoded . @return Returns the resulting XML node that represents the given object .
public Node encode(mxCodec enc, Object obj)
	{
		Node node = enc.document.createElement(getName());
		obj = beforeEncode(enc, obj, node);
		encodeObject(enc, obj, node);
		return afterEncode(enc, obj, node);
	}
public Node encode ( mxCodec enc , Object obj ) { Node node = enc . document . createElement ( getName ( ) ) ; obj = beforeEncode ( enc , obj , node ) ; encodeObject ( enc , obj , node ) ; return afterEncode ( enc , obj , node ) ; }
Encodes the specified object and returns a node representing then given
 object.
Encodes the specified object and returns a node representing then given object .