Package VASSAL.build
Class Builder
java.lang.Object
VASSAL.build.Builder
public abstract class Builder extends Object
This class holds static convenience methods for building
Buildable
objects.-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description static void
build(Element e, Buildable parent)
General building algorithm.static Buildable
create(Element e)
Create an instance of a class from an XML element and build it.static Document
createDocument(InputStream in)
Read an XML document from an InputStreamstatic Document
createNewDocument()
Create a new XML documentstatic String
getText(Element e)
static void
main(String[] args)
static String
toString(Document doc)
static void
writeDocument(Document doc, Writer writer)
Write an XML document to a Writer
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
General building algorithm. For each subelement of the build Element, this method creates an instance of the class (which must implement Buildable) whose name matches the XML element tag name, builds that instance with the subelement, and adds it to the parent Buildable This algorithm calls a component'sBuildable.build(org.w3c.dom.Element)
method before calling itsBuildable.addTo(VASSAL.build.Buildable)
method- Parameters:
parent
- the parent Buildable instance
-
create
Create an instance of a class from an XML element and build it. The.class
file for the named class may be either in the System's classpath or else within theDataArchive
of theGameModule
.- Throws:
IllegalBuildException
- if something goes wrong when loading the class or creating an instance of it
-
createDocument
Read an XML document from an InputStream- Returns:
- the XML document
- Throws:
IOException
-
createNewDocument
Create a new XML document- Returns:
- the Document
-
writeDocument
Write an XML document to a Writer- Parameters:
doc
- Document to be writtenwriter
- target XML Writer- Throws:
IOException
-
getText
- Returns:
- the decoded text contents of an Element node
-
toString
- Returns:
- a String representation of an XML document
-
main
-