T - the bean typepublic class BufferingBeanBuilder<T extends Bean> extends Object implements BeanBuilder<T>
BeanBuilder that buffers data in a local map.
This is useful for cases where the builder data might be manipulated before the final build. The buffer can be directly mutated.
| Constructor and Description |
|---|
BufferingBeanBuilder(MetaBean metaBean)
Constructs the builder wrapping the target bean.
|
| Modifier and Type | Method and Description |
|---|---|
T |
build()
Builds the bean from the state of the builder.
|
<P> P |
get(MetaProperty<P> metaProperty)
Gets the buffered value associated with the specified property name.
|
Object |
get(String propertyName)
Gets the buffered value associated with the specified property name.
|
ConcurrentMap<MetaProperty<?>,Object> |
getBuffer()
Gets the buffer holding the state of the builder.
|
MetaBean |
getMetaBean()
Gets the meta-beans.
|
static BufferingBeanBuilder<?> |
of(MetaBean metaBean)
Constructs the builder wrapping the target bean.
|
BeanBuilder<T> |
set(MetaProperty<?> metaProperty,
Object value)
Sets the value of a single property into the builder.
|
BeanBuilder<T> |
set(String propertyName,
Object value)
Sets the value of a single property into the builder.
|
String |
toString()
Returns a string that summarises the builder.
|
public BufferingBeanBuilder(MetaBean metaBean)
metaBean - the target meta-bean, not nullpublic static BufferingBeanBuilder<?> of(MetaBean metaBean)
metaBean - the target meta-bean, not nullpublic MetaBean getMetaBean()
public ConcurrentMap<MetaProperty<?>,Object> getBuffer()
The buffer may be mutated.
public Object get(String propertyName)
get in interface BeanBuilder<T extends Bean>propertyName - the property name, not nullpublic <P> P get(MetaProperty<P> metaProperty)
get in interface BeanBuilder<T extends Bean>P - the type of the property.metaProperty - the meta-property, not nullpublic BeanBuilder<T> set(String propertyName, Object value)
BeanBuilder
This will normally behave as per a Map, however it may not
and as a general rule callers should only set each property once.
set in interface BeanBuilder<T extends Bean>propertyName - the property name to set, not nullvalue - the property value, may be nullthis, for chaining, not nullpublic BeanBuilder<T> set(MetaProperty<?> metaProperty, Object value)
BeanBuilder
This will normally behave as per a Map, however it may not
and as a general rule callers should only set each property once.
set in interface BeanBuilder<T extends Bean>metaProperty - the meta-property to set, not nullvalue - the property value, may be nullthis, for chaining, not nullpublic T build()
BeanBuilderOnce this method has been called, the builder is in an invalid state. The effect of further method calls is undetermined.
build in interface BeanBuilder<T extends Bean>Copyright © 2007–2017 Joda.org. All rights reserved.