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 voidbuild(Element e, Buildable parent)General building algorithm.static Buildablecreate(Element e)Create an instance of a class from an XML element and build it.static DocumentcreateDocument(InputStream in)Read an XML document from an InputStreamstatic DocumentcreateNewDocument()Create a new XML documentstatic StringgetText(Element e)static voidmain(String[] args)static StringtoString(Document doc)static voidwriteDocument(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.classfile for the named class may be either in the System's classpath or else within theDataArchiveof 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
-