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.entity(Customer.TYPE)
.with(Customer.FIRST_NAME, "John")
.with(Customer.LAST_NAME, "Doe")
.build();
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the Entity instanceClears the primary key values from this builder, current as well as original values if anyResets the primary to its original state, in case the original value is available<T> Entity.Builder
Adds 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
-
originalPrimaryKey
Entity.Builder originalPrimaryKey()Resets the primary to its original state, in case the original value is available- Returns:
- this builder instance
-
build
Entity build()Builds the Entity instance- Returns:
- a new Entity instance
-