public static final class AbstractBuilder.BuilderElement extends AbstractElement
Note: This class if final to allow the class comparison in
AbstractBuilder
.subElements() method.
ELEMENT_TYPE
Constructor and Description |
---|
AbstractBuilder.BuilderElement(String name,
AbstractBuilder builder)
Creates a new
AbstractBuilder.BuilderElement . |
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
Accepts the visitor and calls the appropriate method on the visitor based
on the element type.
|
Element |
build()
Constructs the final form of the element being constructed by the
encapsulated builder.
|
ElementType |
getType()
Returns the type for the BSON type.
|
Object |
getValueAsObject()
Returns the value for BSON element as a Java
Object type. |
AbstractBuilder.BuilderElement |
withName(String name)
Creates a new element with the same type and value as this element but
with the specified name.
|
asElement, compareTo, equals, find, find, findFirst, findFirst, getName, getValueAsString, hashCode, nullSafeEquals, size, toString
public AbstractBuilder.BuilderElement(String name, AbstractBuilder builder)
AbstractBuilder.BuilderElement
.name
- The name for the element to build.builder
- The Builder doing the building.public void accept(Visitor visitor)
visitor
- The visitor for the element.public Element build()
public ElementType getType()
public Object getValueAsObject()
Object
type.
Automatic conversion from the Object-ified value to an element is
provided via the DocumentBuilder.add(String, Object)
method. Not
all element types will be successfully converted to the same element
duing a Element-->Object value-->Element conversion. This cases are noted
in the appropriate sub-type's JavaDoc.
Sub-types will also overload this method with the appropriate type
returned. e.g., The
StringElement.getValueAsObject()
method signature returns a String
.
Overridden to return null as this class should not be seen outside of the builders.
Object
type.public AbstractBuilder.BuilderElement withName(String name)
Returns a new AbstractBuilder.BuilderElement
.
name
- The new name for the element.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.