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();
See Also:
  • Method Details

    • with

      <T> Entity.Builder with(Attribute<T> attribute, T value)
      Adds the given attribute value to this builder
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute
      value - 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
    • key

      Creates a new Entity.Key.Builder instance, 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