org.qi4j.spi.entity

## Interface EntityState

- All Known Subinterfaces:
    SQLEntityState
  All Known Implementing Classes:
    DefaultEntityState, JSONEntityState, SQLEntityState.DefaultSQLEntityState

      public interface EntityState

  State holder for Entities.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `EntityReference` | `associationValueOf(QualifiedName stateName)`
    `EntityDescriptor` | `entityDescriptor()`
    `EntityReference` | `identity()` Returns the identity of the entity that this EntityState represents.
    `boolean` | `isAssignableTo(Class<?> type)`
    `long` | `lastModified()` Last modified timestamp of the entity.
    `ManyAssociationState` | `manyAssociationValueOf(QualifiedName stateName)`
    `NamedAssociationState` | `namedAssociationValueOf(QualifiedName stateName)`
    `Object` | `propertyValueOf(QualifiedName stateName)`
    `void` | `remove()` Remove the entity represented by this EntityState when the unit of work is completed.
    `void` | `setAssociationValue(QualifiedName stateName, EntityReference newEntity)`
    `void` | `setPropertyValue(QualifiedName stateName, Object json)`
    `EntityStatus` | `status()` The status of this EntityState
    `String` | `version()` Version of the entity.

- - ### Method Detail

    - #### identity

          EntityReference identity()

      Returns the identity of the entity that this EntityState represents.
      Returns:
        the identity of the entity that this EntityState represents.

    - #### version

          String version()

      Version of the entity. This is managed by the EntityStore.

      If the underlying EntityStore does not support versioning, then version must always be set to 0.

      Returns:
        version of the entity

    - #### lastModified

          long lastModified()

      Last modified timestamp of the entity. This is managed by the EntityStore.

      If the underlying EntityStore does not support timestamping, then last modified must always be set to the current time.

      Returns:
        last modified timestamp of the entity, as defined by System.currentTimeMillis()

    - #### remove

          void remove()

      Remove the entity represented by this EntityState when the unit of work is completed.

    - #### status

          EntityStatus status()

      The status of this EntityState
      Returns:
        the status

    - #### isAssignableTo

          boolean isAssignableTo(Class<?> type)

    - #### entityDescriptor

          EntityDescriptor entityDescriptor()

    - #### propertyValueOf

          Object propertyValueOf(QualifiedName stateName)

    - #### setPropertyValue

          void setPropertyValue(QualifiedName stateName,
                              Object json)

    - #### associationValueOf

          EntityReference associationValueOf(QualifiedName stateName)

    - #### setAssociationValue

          void setAssociationValue(QualifiedName stateName,
                                 EntityReference newEntity)

    - #### manyAssociationValueOf

          ManyAssociationState manyAssociationValueOf(QualifiedName stateName)

    - #### namedAssociationValueOf

          NamedAssociationState namedAssociationValueOf(QualifiedName stateName)