Module is.codion.framework.domain
Interface Entity.Builder
- Enclosing interface:
- Entity
public static interface Entity.Builder
A builder for
Entity instances.
Store domain = new Store();
Entities entities = domain.entities();
Entity customer = entities.builder(Customer.TYPE)
.with(Customer.FIRST_NAME, "John")
.with(Customer.LAST_NAME, "Doe")
.build();
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the Entity instanceClears the primary key values from this builder, current as well as original values if anykey()Creates a newEntity.Key.Builderinstance, initialized with any primary key values found in this builder.<T> Entity.BuilderAdds the given attribute value to this builderSets the default value for all attributes which have a default value.
-
Method Details
-
with
Adds the given attribute value to this builder- Type Parameters:
T- the value type- Parameters:
attribute- the attributevalue- the value- Returns:
- this builder instance
-
withDefaults
Entity.Builder withDefaults()Sets the default value for all attributes which have a default value.- Returns:
- this builder instance
- See Also:
-
clearPrimaryKey
Entity.Builder clearPrimaryKey()Clears the primary key values from this builder, current as well as original values if any- Returns:
- this builder instance
-
key
Entity.Key.Builder key()Creates a newEntity.Key.Builderinstance, initialized with any primary key values found in this builder.- Returns:
- a new
Entity.Key.Builder
-
build
Entity build()Builds the Entity instance- Returns:
- a new Entity instance
-