|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jrunx.xml.XMLMetaData
XMLMetaData is a utility class useful for creating Java classes that represent an XML document. The objects are simple Java bean like objects that rely on the XMLMetaData base class for importing/exporting the XML document to a file. Base classes and consumers of these classes need not concern themselves with any XML parser APIs. By following a set of rules on member variable types and names the XML is imported and exported automatically. The rules are:
| Inner Class Summary | |
class |
XMLMetaData.BaseException
|
class |
XMLMetaData.CouldNotCreateDocumentException
Could not create document from location '{location}' |
class |
XMLMetaData.CreateInstanceException
Could not create an instance of {className} |
class |
XMLMetaData.ElementRequiredException
{location}:{line}: The '{child}' element is a required child of '{parent}' |
class |
XMLMetaData.IntegerExpectedException
{location}:{line}: Expected an integer for {elementName} element, got {value} |
class |
XMLMetaData.InvalidElementException
{location}:{line}: The '{name}' element's value must be one of {list} |
class |
XMLMetaData.InvalidObjectException
{location}:{line}: {className}'s toString() method returned '{objStr}' but the variable passed into its String constructor was '{constStr}'. |
class |
XMLMetaData.MetaDataExportIOException
IOException exporting document to {location}: {message} |
class |
XMLMetaData.NoLocationException
Tried to export a XMLMetaData document with no source specified, setSource must be called first. |
class |
XMLMetaData.NoStringConstructorException
{location}:{line}: Couldn't create an instance of {className}, which must have a String constructor: {excStr} |
class |
XMLMetaData.UnsupportedArrayTypeException
The class {cls} has an array of type {arrayType} which is not supported |
| Field Summary | |
protected Logger |
logger
|
| Constructor Summary | |
XMLMetaData()
Use this to build a new MetaData object from scratch, if this isn't the root node use the constructor where you pass in the parent MetaData instead. |
|
XMLMetaData(java.io.File file)
|
|
XMLMetaData(java.net.URL url)
|
|
XMLMetaData(java.net.URL url,
java.lang.String[] pkgs)
|
|
XMLMetaData(java.net.URL url,
java.lang.String[] pkgs,
Logger lg)
|
|
XMLMetaData(XMLMetaData parent)
Use this constructor to add a new XMLMetaData object to its parent, this will set the field for this type in the parent or add it to the List of metadatas in the parent. |
|
| Method Summary | |
void |
addAcronym(java.lang.String acronym)
|
void |
addAcronyms(java.util.Collection acronyms)
|
void |
addPackagePrefix(java.lang.String prefix)
add a package to search list for resolving List fields names into types |
void |
addPackagePrefixes(java.util.Collection packages)
|
void |
exportDocument()
Write document back out to its location |
java.lang.String |
getAttribute(java.lang.String name)
|
java.net.URL |
getMetaDataSource()
|
XMLMetaData |
getParent()
|
PersistenceContext |
getPersistenceContext()
|
java.lang.String |
getText()
|
protected void |
importXML()
Imports the information into this metadata object from a DOM element |
void |
importXML(java.net.URL url)
Make this XMLMetaData object reflect the XML at the URL location |
void |
remove()
Remove this MetaData element, this entails: - removing my element from my parent - if my parent refers to me in a List, remove myself from that list - if my parent refers to me directly, null out that field Note that there is no corresponding add, adding elements is done |
void |
removeAttribute(java.lang.String name)
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
|
void |
setMetaDataSource(java.io.File file)
|
void |
setMetaDataSource(java.net.URL url)
|
void |
setParent(XMLMetaData parent)
XMLMetaData objects that don't represent the top level element have a reference to their parent. |
void |
setParent(XMLMetaData parent,
boolean sync)
|
void |
setPersistenceContext(PersistenceContext persistence)
|
void |
setPublicID(java.lang.String publicID)
|
void |
setSystemID(java.lang.String systemID)
|
void |
setText(java.lang.String text)
|
void |
sync()
sync terminals with DOM |
void |
sync(boolean force)
|
java.lang.String |
toString()
Return a String representation of the document |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected transient Logger logger
| Constructor Detail |
public XMLMetaData()
public XMLMetaData(XMLMetaData parent)
public XMLMetaData(java.io.File file)
throws MetaDataException
public XMLMetaData(java.net.URL url)
throws MetaDataException
public XMLMetaData(java.net.URL url,
java.lang.String[] pkgs)
throws MetaDataException
public XMLMetaData(java.net.URL url,
java.lang.String[] pkgs,
Logger lg)
throws MetaDataException
| Method Detail |
public void addAcronym(java.lang.String acronym)
public void addAcronyms(java.util.Collection acronyms)
public void addPackagePrefix(java.lang.String prefix)
public void addPackagePrefixes(java.util.Collection packages)
public void importXML(java.net.URL url)
throws MetaDataException
public void exportDocument()
throws MetaDataException
public java.net.URL getMetaDataSource()
public void setMetaDataSource(java.io.File file)
public void setMetaDataSource(java.net.URL url)
public void remove()
public XMLMetaData getParent()
public void setParent(XMLMetaData parent)
public void setParent(XMLMetaData parent,
boolean sync)
public void setPublicID(java.lang.String publicID)
public void setSystemID(java.lang.String systemID)
public void sync()
public void sync(boolean force)
public void setAttribute(java.lang.String name,
java.lang.String value)
public java.lang.String getAttribute(java.lang.String name)
public void removeAttribute(java.lang.String name)
public java.lang.String getText()
public void setText(java.lang.String text)
protected void importXML()
throws MetaDataException
public void setPersistenceContext(PersistenceContext persistence)
public PersistenceContext getPersistenceContext()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||