public abstract class AbstractBuilder extends Object implements Builder
Modifier and Type | Class and Description |
---|---|
static class |
AbstractBuilder.BuilderElement
A temporary Element to stand in for a element being constructed with a
builder.
|
Modifier and Type | Field and Description |
---|---|
protected static boolean |
ASSERTIONS_ENABLED
If true then assertions have been enabled for the class.
|
protected static Class<AbstractBuilder.BuilderElement> |
BUILDER_ELEMENT_CLASS
The class used for intermediate sub-builders in the elements list.
|
protected List<Element> |
myElements
The list of elements in the builder.
|
protected long |
mySize
The size of the document added.
|
Constructor and Description |
---|
AbstractBuilder(AbstractBuilder outerBuilder)
Creates a new builder.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Element |
build(String name)
Constructs the final form of the element being constructed.
|
protected DocumentBuilder |
doPush(String name)
Pushes a context for constructing a sub-document.
|
protected ArrayBuilder |
doPushArray(String name)
Pushes a context for constructing a sub-array.
|
Builder |
pop()
Pops the sub-context.
|
Builder |
reset()
Resets the builder back to an empty state.
|
protected List<Element> |
subElements()
Renders the final form of the sub elements in the builder replacing all
AbstractBuilder.BuilderElement s with the final element form. |
protected static final boolean ASSERTIONS_ENABLED
protected static final Class<AbstractBuilder.BuilderElement> BUILDER_ELEMENT_CLASS
protected long mySize
public AbstractBuilder(AbstractBuilder outerBuilder)
outerBuilder
- The outer scoped builder.public Builder pop()
public Builder reset()
protected abstract Element build(String name)
name
- The name of the element.protected DocumentBuilder doPush(String name)
name
- The name of the sub-document.DocumentBuilder
for constructing the sub-document.protected ArrayBuilder doPushArray(String name)
name
- The name of the sub-array.ArrayBuilder
for constructing the sub-array.protected List<Element> subElements()
AbstractBuilder.BuilderElement
s with the final element form.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.