public class AbstractBeanEntityBuilder extends EntityBuilder
Base class for entity builders using bean-style setters. An entity builder should extend this class, then annotate setter methods with EntityAttributeSetter
(and clearers with EntityAttributeClearer
). The standard methods will then be implemented in terms of these.
Modifier and Type | Class and Description |
---|---|
static class |
AbstractBeanEntityBuilder.AttrMethod
Abstract class for accessing attribute methods.
|
static class |
AbstractBeanEntityBuilder.DoubleAttrMethod |
static class |
AbstractBeanEntityBuilder.LongAttrMethod |
id, idSet, type
Modifier | Constructor and Description |
---|---|
protected |
AbstractBeanEntityBuilder(EntityType type) |
Modifier and Type | Method and Description |
---|---|
Entity |
build()
Build the entity.
|
EntityBuilder |
clearAttribute(TypedName<?> name)
Clear an attribute.
|
void |
clearExtraAttribute(TypedName<?> name)
Clear an extra attribute.
|
<T> EntityBuilder |
setAttribute(TypedName<T> name,
T val)
Set an attribute in the entity.
|
<T> void |
setExtraAttribute(TypedName<T> name,
T val)
Set an extra attribute.
|
EntityBuilder |
setLongAttribute(TypedName<java.lang.Long> name,
long val)
Set an attribute in the entity.
|
reset, setAttribute, setDoubleAttribute, setId
protected AbstractBeanEntityBuilder(EntityType type)
public <T> EntityBuilder setAttribute(TypedName<T> name, T val)
EntityBuilder
Set an attribute in the entity.
setAttribute
in class EntityBuilder
name
- The name of the attribute to set.val
- The attribute value.public EntityBuilder clearAttribute(TypedName<?> name)
EntityBuilder
Clear an attribute.
clearAttribute
in class EntityBuilder
name
- The name of the attribute to clear.public <T> void setExtraAttribute(TypedName<T> name, T val)
Set an extra attribute. An extra attribute is an attribute that is not provided by a bean-style setter.
The default implementation throws NoSuchAttributeException
.
name
- The attribute name to clear.val
- The attribute value to set.public void clearExtraAttribute(TypedName<?> name)
Clear an extra attribute. An extra attribute is an attribute that is not provided by a bean-style setter.
The default implementation does nothing.
name
- The attribute name to clear.public EntityBuilder setLongAttribute(TypedName<java.lang.Long> name, long val)
EntityBuilder
Set an attribute in the entity.
setLongAttribute
in class EntityBuilder
name
- The name of the attribute to set.val
- The attribute value.public Entity build()
EntityBuilder
Build the entity.
build
in class EntityBuilder