|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdom.contrib.input.ResultSetBuilder
public class ResultSetBuilder
ResultSetBuilder builds a JDOM tree from a
java.sql.ResultSet. Many good ideas were leveraged from
SQLBuilder written from Jon Baer.
Issues: Do attributes have to be added in a namespace?
| Constructor Summary | |
|---|---|
ResultSetBuilder(java.sql.ResultSet rs)
This sets up a java.sql.ResultSet to be built
as a Document. |
|
ResultSetBuilder(java.sql.ResultSet rs,
java.lang.String rootName,
java.lang.String rowName)
This sets up a java.sql.ResultSet to be built
as a Document. |
|
ResultSetBuilder(java.sql.ResultSet rs,
java.lang.String rootName,
java.lang.String rowName,
org.jdom.Namespace ns)
This sets up a java.sql.ResultSet to be built
as a Document. |
|
| Method Summary | |
|---|---|
org.jdom.Document |
build()
This builds a Document from the
java.sql.ResultSet. |
protected java.lang.String |
getString(java.sql.ResultSet rs,
int column,
int columnType)
|
void |
setAsAttribute(int columnNum)
Set a column as an Attribute of a row using the
column number. |
void |
setAsAttribute(int columnNum,
java.lang.String attribName)
Set a column as an Attribute of a row using the
column number. |
void |
setAsAttribute(java.lang.String columnName)
Set a column as an Attribute of a row using the
original column name. |
void |
setAsAttribute(java.lang.String columnName,
java.lang.String attribName)
Set a column as an Attribute of a row using the
column name. |
void |
setAsElement(int columnNum,
java.lang.String elemName)
Set a column as an Element of a row using the
column number. |
void |
setAsElement(java.lang.String columnName,
java.lang.String elemName)
Set a column as an Element of a row using the
column name. |
void |
setMaxRows(int maxRows)
Set the maximum number of rows to add to your Document. |
void |
setNamespace(org.jdom.Namespace ns)
Set the Namespace to use for
each Element in the Document. |
void |
setNullAttribute(java.lang.String nullAttribName,
java.lang.String nullAttribValue)
Set a specific attribute to use to mark that a value in the database was null, not just an empty string. |
void |
setRootName(java.lang.String rootName)
Set the name to use as the root element in the Document. |
void |
setRowName(java.lang.String rowName)
Set the name to use as the row element in the Document. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResultSetBuilder(java.sql.ResultSet rs)
This sets up a java.sql.ResultSet to be built
as a Document.
rs - java.sql.ResultSet to build
public ResultSetBuilder(java.sql.ResultSet rs,
java.lang.String rootName,
java.lang.String rowName)
This sets up a java.sql.ResultSet to be built
as a Document.
rs - java.sql.ResultSet to build fromrootName - String name for the root
Element
of the DocumentrowName - String name for the each immediate child
Element of the root
public ResultSetBuilder(java.sql.ResultSet rs,
java.lang.String rootName,
java.lang.String rowName,
org.jdom.Namespace ns)
This sets up a java.sql.ResultSet to be built
as a Document.
rs - java.sql.ResultSet to build fromrootName - String name for the root
Element
of the DocumentrowName - String name for the each immediate child
Element of the rootns - Namespace to use for each Element| Method Detail |
|---|
public org.jdom.Document build()
throws org.jdom.JDOMException
This builds a Document from the
java.sql.ResultSet.
Document - resultant Document object.
JDOMException - when there is a problem
with the build.
org.jdom.JDOMException
protected java.lang.String getString(java.sql.ResultSet rs,
int column,
int columnType)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void setRootName(java.lang.String rootName)
Document.
rootName - String the new name.public void setRowName(java.lang.String rowName)
Document.
rowName - String the new name.public void setNamespace(org.jdom.Namespace ns)
Set the Namespace to use for
each Element in the Document.
ns - String the namespace to use.public void setMaxRows(int maxRows)
Set the maximum number of rows to add to your
Document.
maxRows - intpublic void setAsAttribute(java.lang.String columnName)
Set a column as an Attribute of a row using the
original column name. The attribute will appear as the original
column name.
columnName - String the original column name
public void setAsAttribute(java.lang.String columnName,
java.lang.String attribName)
Set a column as an Attribute of a row using the
column name. The attribute will appear as the new name provided.
columnName - String original column nameattribName - String new name to use for the attributepublic void setAsAttribute(int columnNum)
Set a column as an Attribute of a row using the
column number. The attribute will appear as the original column
name.
columnNum - int
public void setAsAttribute(int columnNum,
java.lang.String attribName)
Set a column as an Attribute of a row using the
column number. The attribute will appear as new name provided.
columnNum - intattribName - String new name to use for the attribute
public void setAsElement(java.lang.String columnName,
java.lang.String elemName)
Set a column as an Element of a row using the
column name. The element name will appear as the new name provided.
columnName - String original column nameelemName - String new name to use for the element
public void setAsElement(int columnNum,
java.lang.String elemName)
Set a column as an Element of a row using the
column number. The element name will appear as new name provided.
columnNum - intelemName - String new name to use for the element
public void setNullAttribute(java.lang.String nullAttribName,
java.lang.String nullAttribValue)
Set a specific attribute to use to mark that a value in the database was null, not just an empty string. This is necessary because <foo/> semantically represents both null and empty. This method lets you have <foo null="true">.
nullAttribName - String name of attribute to addnullAttribValue - String value to set it to.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||