|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.acsinet_solutions.util.build.BlockBuilder
public class BlockBuilder
An implementation of a builder based in BuildingBlock beans. This represents a very practical way to build objects from a source like an XML file, as a very easy alternative to other libraries that build object hierarchies from XML files.
This class works well with XMLObjectFactory when processing XML files. See BlockBuilerTest source for examples.
WARNING! This class is not intended to be thread safe nor reusable
XMLObjectFactory,
BlockBuilderTest| Constructor Summary | |
|---|---|
BlockBuilder()
Empty constructor |
|
BlockBuilder(java.lang.Class defaultRootClass)
|
|
BlockBuilder(java.lang.Object rootObject)
|
|
| Method Summary | |
|---|---|
void |
enterObject(java.lang.String name,
java.lang.String className)
Add a new object to the builder |
void |
exitObject()
Exit the current object instance. |
java.lang.Object |
getObject()
Get the built object. |
protected void |
setup(java.lang.Object object)
Setup the object before adding it to the parent object. |
void |
setValue(java.lang.String name,
java.lang.Object value)
Set a value to the current target object |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BlockBuilder(java.lang.Object rootObject)
rootObject - The root object that will be the root of the block
building.public BlockBuilder(java.lang.Class defaultRootClass)
defaultRootClass - A maybe-null Class instance valuepublic BlockBuilder()
| Method Detail |
|---|
public final void enterObject(java.lang.String name,
java.lang.String className)
throws BuildException
Builder
enterObject in interface Buildername - The not-null not-empty name of the type instanceclassName - The maybe-null class type of the instance
BuildException - Thrown if any building error occurs
public final void setValue(java.lang.String name,
java.lang.Object value)
throws BuildException
Builder
setValue in interface Buildername - The not-null not-empty name of the attribute to be setvalue - The maybe-null value of the given attribute
BuildException - Thrown if any building error occurs
public final void exitObject()
throws BuildException
Builder
exitObject in interface BuilderBuildException - Thrown if any building error occurs
public final java.lang.Object getObject()
throws BuildException
Builder
getObject in interface BuilderBuildException - Thrown if any building error occurs
protected void setup(java.lang.Object object)
throws BuildException
BuildException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||