public class XMLSerializationMethodHandler extends Object implements RevisionHandler
readFromXML()
and
writeToXML()
methods in the XMLSerialization
class.MethodHandler
,
XMLSerialization
Modifier and Type | Field and Description |
---|---|
protected MethodHandler |
m_ReadMethods
for storing read methods
|
protected MethodHandler |
m_WriteMethods
for storing write methods
|
protected Object |
owner
the object to retrieve the methods from
|
Constructor and Description |
---|
XMLSerializationMethodHandler(Object owner)
initializes the method handling, executes also
clear() , which
adds initial methods automatically. |
Modifier and Type | Method and Description |
---|---|
protected void |
addMethods()
automatically adds all fitting methods to the custom read/write lists,
it excludes only the generic ones.
|
protected void |
addMethods(MethodHandler handler,
Method template,
Method[] methods)
adds all methods that are like
template to the method list |
void |
clear()
removes all current methods and adds the methods according to the
|
static Method |
findReadMethod(Object o,
String name)
returns the method with the given name that has the same signature as
readFromXML() of the XMLSerialiation class. |
static Method |
findWriteMethod(Object o,
String name)
returns the method with the given name that has the same signature as
writeToXML() of the XMLSerialiation class. |
String |
getRevision()
Returns the revision string.
|
MethodHandler |
read()
returns the handler for read methods
|
void |
register(Object handler,
Class cls,
String name)
adds read and write methods for the given class, i.e., read&;lt;name>
and write<name> ("name" is prefixed by read and write)
|
String |
toString()
returns the read and write method handlers as string
|
MethodHandler |
write()
returns the handler for write methods
|
protected MethodHandler m_ReadMethods
protected MethodHandler m_WriteMethods
protected Object owner
protected void addMethods(MethodHandler handler, Method template, Method[] methods)
template
to the method listhandler
- the list to add fitting methods totemplate
- the signature to check the given methods againstmethods
- the methods to checkprotected void addMethods() throws Exception
clear()
It only work with methods that apply to the naming rule "read" + property
name (same for "write")public static Method findReadMethod(Object o, String name)
readFromXML()
of the XMLSerialiation
class.
simplifies the adding of custom methods.o
- the object to inspectname
- the name of the method to returnnull
if no method was found or a referenceXMLSerialization.readFromXML(Element)
public static Method findWriteMethod(Object o, String name)
writeToXML()
of the XMLSerialiation
class.
simplifies the adding of custom methods.o
- the object to inspectname
- the name of the method to returnnull
if no method was found or a referenceXMLSerialization.writeToXML(Element, Object, String)
public void clear()
public MethodHandler read()
public MethodHandler write()
public void register(Object handler, Class cls, String name)
handler
- the handler class that contains the read and write methodcls
- the class to register the read and write method forname
- the suffix of the read and write methodpublic String toString()
public String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.