|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ephman.abra.tools.XmlProcessor | +--org.ephman.abra.tools.Marshaller
A class to marshall from Java classes to XML docs. instantiate with a mapping file conforming to http://charzard/codegen.dtd package org.ephman use the same package MapToJava to generate code from that map file with approptiate get/set methods and for a Vector foo, addToFoo
Field Summary | |
protected static java.lang.String |
_ID
constants to handle circular links |
protected static java.lang.String |
_IDREF
|
protected java.lang.ClassLoader |
classLoader
|
protected java.lang.Object[] |
dummyArray
|
protected static java.lang.String |
RUN_TIME
|
(package private) java.lang.Class |
string
|
static java.lang.String |
VERSION_NUMBER
|
Fields inherited from class org.ephman.abra.tools.XmlProcessor |
useAbraParser |
Constructor Summary | |
Marshaller()
|
|
Marshaller(java.lang.String mapFileName)
|
Method Summary | |
void |
addMapFile(java.io.Reader reader,
boolean validating,
java.lang.String inputName)
to add a mapfile to a given marshaller thus extending the set of classes that the marshaller knows how to marshal and unmarshal |
void |
addMapFile(java.lang.String mapFileName)
|
void |
addMapFile(java.lang.String mapFileName,
boolean validating)
|
protected void |
applyRules(org.w3c.dom.Element e,
java.lang.String mapName)
|
protected void |
applyRules(org.ephman.xml.XmlNode thisNode,
java.lang.String mapFile)
|
protected java.lang.Class |
getAClass(java.lang.String className)
helper method to get a java.lang.Class object given a type (including primitives like int.class) |
protected java.lang.reflect.Method |
getASetMethod(java.lang.Class c,
java.lang.String methodName,
java.lang.Class paramClass)
|
protected java.lang.reflect.Method |
getASetMethod(java.lang.Class c,
java.lang.String methodName,
java.lang.String paramClassName)
|
protected java.lang.String |
getClassName(java.lang.Object obj)
|
protected java.sql.Timestamp |
getDate(java.lang.String value,
UnmarshalContext context)
|
protected java.lang.String |
getFieldType(java.lang.String fieldType)
get a native type primary class name (so for 'int' return 'java.lang.Integer' |
protected java.lang.String |
getNameFromMethod(java.lang.reflect.Method m)
|
(package private) java.lang.Object |
getPrimitive(org.ephman.xml.XmlNode thisNode,
JField jf,
UnmarshalContext context)
|
protected boolean |
isNativeType(java.lang.String typeName)
|
java.lang.String |
marshal(java.lang.Object obj)
a routine to marshal objects to xml strings uses descriptor class - if not found uses reflection from mapping.. |
protected java.lang.String |
marshal(java.lang.Object obj,
MarshalContext context,
java.lang.String nodeName)
|
protected java.lang.String |
marshal(java.lang.Object obj,
MarshalContext context,
java.lang.String nodeName,
java.lang.String compileTimeType)
|
(package private) java.lang.String |
objectOut(JField jf,
java.lang.Object value,
MarshalContext context)
aroutine to find the text output for an object. |
protected void |
recurseOnChildList(java.util.Vector children,
java.lang.Object obj,
XmlDescriptor desc,
UnmarshalContext context)
|
protected java.lang.String |
reflectMarshal(java.lang.Object obj)
try to use reflection to marshal a Java Class to an XML representation |
protected java.lang.String |
reflectMarshal(java.lang.Object obj,
MarshalContext context)
|
protected java.lang.String |
reflectMarshal(java.lang.Object obj,
MarshalContext context,
java.lang.String nodeName)
|
protected void |
setAllAttributes(org.ephman.xml.XmlNode thisNode,
java.lang.Object obj,
XmlDescriptor desc,
UnmarshalContext context)
|
protected void |
setArray(JField jf,
java.util.Vector nodes,
java.lang.Object obj,
XmlDescriptor desc,
UnmarshalContext context)
a method to set an array described by jf into obj (whose descriptor is desc |
protected void |
setDate(java.lang.Object o,
java.lang.reflect.Method m,
java.lang.String value,
UnmarshalContext context)
|
protected void |
setElement(org.ephman.xml.XmlNode thisNode,
java.lang.Object obj,
XmlDescriptor desc,
UnmarshalContext context)
|
void |
setIdTagsOff()
method to remove "ID" tags (will throw exception if circular ref..) |
void |
setMarshalDateFormat(java.lang.String format)
|
void |
setUnmarshalDateFormats(java.lang.String[] formats)
method to allow setting of unmarshal formats.. |
void |
setWriteRunTimeTypes(boolean b)
|
java.lang.Object |
unmarshal(java.io.Reader r)
|
java.lang.Object |
unmarshal(java.io.Reader r,
boolean ignoreMissingFields)
|
java.lang.Object |
unmarshal(java.lang.String xmlText)
a routine to unmarshal xml text to a Java object - assumes that the class is loadable and that the object is described in the map file |
java.lang.Object |
unmarshal(java.lang.String xmlText,
boolean ignoreMissingFields)
|
protected java.lang.Object |
unmarshal(org.ephman.xml.XmlNode thisNode,
UnmarshalContext context,
XmlDescriptor desc)
a routine to be called on a composite node - with the current context and the Xml descriptor for this object |
void |
useAbraXmlParser()
|
Methods inherited from class org.ephman.abra.tools.XmlProcessor |
mapXMLFile, mapXMLFile, mapXMLFile, mapXMLFile, recurseOnChildList |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.lang.String _ID
protected static java.lang.String _IDREF
protected static java.lang.String RUN_TIME
protected java.lang.ClassLoader classLoader
java.lang.Class string
protected java.lang.Object[] dummyArray
public static final java.lang.String VERSION_NUMBER
Constructor Detail |
public Marshaller() throws java.lang.Exception
public Marshaller(java.lang.String mapFileName) throws java.lang.Exception
Method Detail |
public void useAbraXmlParser()
public void setIdTagsOff()
public void setWriteRunTimeTypes(boolean b)
public void setUnmarshalDateFormats(java.lang.String[] formats)
public void setMarshalDateFormat(java.lang.String format)
public void addMapFile(java.lang.String mapFileName, boolean validating) throws java.lang.Exception
mapFileName
- the path and file name of an xml file conforming to
codegen.dtd
add a mapfile using a String fileName..
java.lang.Exception
public void addMapFile(java.lang.String mapFileName) throws java.lang.Exception
java.lang.Exception
public void addMapFile(java.io.Reader reader, boolean validating, java.lang.String inputName) throws java.lang.Exception
reader
- -validating
- whether or not to use any dtds to validate..
java.io.IOException
- if file un-openable
java.lang.Exception
public java.lang.String marshal(java.lang.Object obj) throws java.lang.Exception
java.lang.Exception
protected java.lang.String marshal(java.lang.Object obj, MarshalContext context, java.lang.String nodeName) throws java.lang.Exception
java.lang.Exception
protected java.lang.String marshal(java.lang.Object obj, MarshalContext context, java.lang.String nodeName, java.lang.String compileTimeType) throws java.lang.Exception
java.lang.Exception
java.lang.String objectOut(JField jf, java.lang.Object value, MarshalContext context)
protected java.lang.String reflectMarshal(java.lang.Object obj) throws java.lang.Exception
obj
- any object
java.lang.Exception
protected boolean isNativeType(java.lang.String typeName)
protected java.lang.String getClassName(java.lang.Object obj)
protected java.lang.String reflectMarshal(java.lang.Object obj, MarshalContext context) throws java.lang.Exception
java.lang.Exception
protected java.lang.String reflectMarshal(java.lang.Object obj, MarshalContext context, java.lang.String nodeName) throws java.lang.Exception
java.lang.Exception
protected java.lang.String getNameFromMethod(java.lang.reflect.Method m) throws java.lang.Exception
java.lang.Exception
public java.lang.Object unmarshal(java.lang.String xmlText) throws java.lang.Exception
xmlText
- an xml text string - whose root node was described in the map file
java.lang.Exception
- - when the xml-Java descriptor is not found or the Java object is not found
by the class loader - or when the xml is not well formedpublic java.lang.Object unmarshal(java.lang.String xmlText, boolean ignoreMissingFields) throws java.lang.Exception
java.lang.Exception
public java.lang.Object unmarshal(java.io.Reader r) throws java.lang.Exception
java.lang.Exception
public java.lang.Object unmarshal(java.io.Reader r, boolean ignoreMissingFields) throws java.lang.Exception
java.lang.Exception
protected java.lang.Object unmarshal(org.ephman.xml.XmlNode thisNode, UnmarshalContext context, XmlDescriptor desc) throws java.lang.Exception
thisNode
- the org.w3c Elementcontext
- a wrapper containing the ID and IDREF tagsdesc
- for the object to be built containing attributes
and elements..
java.lang.Exception
protected void setArray(JField jf, java.util.Vector nodes, java.lang.Object obj, XmlDescriptor desc, UnmarshalContext context) throws java.lang.Exception
java.lang.Exception
protected void setAllAttributes(org.ephman.xml.XmlNode thisNode, java.lang.Object obj, XmlDescriptor desc, UnmarshalContext context) throws java.lang.Exception
java.lang.Exception
protected void setDate(java.lang.Object o, java.lang.reflect.Method m, java.lang.String value, UnmarshalContext context) throws java.lang.Exception
java.lang.Exception
protected java.sql.Timestamp getDate(java.lang.String value, UnmarshalContext context)
protected java.lang.Class getAClass(java.lang.String className) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
protected java.lang.reflect.Method getASetMethod(java.lang.Class c, java.lang.String methodName, java.lang.String paramClassName) throws java.lang.Exception
java.lang.Exception
protected java.lang.reflect.Method getASetMethod(java.lang.Class c, java.lang.String methodName, java.lang.Class paramClass) throws java.lang.Exception
java.lang.Exception
protected void setElement(org.ephman.xml.XmlNode thisNode, java.lang.Object obj, XmlDescriptor desc, UnmarshalContext context) throws java.lang.Exception
java.lang.Exception
java.lang.Object getPrimitive(org.ephman.xml.XmlNode thisNode, JField jf, UnmarshalContext context) throws java.lang.Exception
java.lang.Exception
protected void recurseOnChildList(java.util.Vector children, java.lang.Object obj, XmlDescriptor desc, UnmarshalContext context) throws java.lang.Exception
java.lang.Exception
protected java.lang.String getFieldType(java.lang.String fieldType)
protected void applyRules(org.w3c.dom.Element e, java.lang.String mapName) throws javax.xml.parsers.ParserConfigurationException, java.io.FileNotFoundException, java.io.IOException, org.xml.sax.SAXException, SchemaException
javax.xml.parsers.ParserConfigurationException
java.io.FileNotFoundException
java.io.IOException
org.xml.sax.SAXException
SchemaException
protected void applyRules(org.ephman.xml.XmlNode thisNode, java.lang.String mapFile) throws org.ephman.xml.XmlException, java.io.IOException, SchemaException
applyRules
in class XmlProcessor
org.ephman.xml.XmlException
java.io.IOException
SchemaException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |