org.qi4j.spi.entitystore.helpers

## Class JSONEntityState

- java.lang.Object
- - org.qi4j.spi.entitystore.helpers.JSONEntityState

- All Implemented Interfaces:
    EntityState

      public final class JSONEntityState
      extends Object
      implements EntityState

  Standard JSON implementation of EntityState.

- - ### 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)`
    `void` | `markUpdated()`
    `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 newValue)`
    `JSONObject` | `state()`
    `EntityStatus` | `status()` The status of this EntityState
    `String` | `toString()`
    `String` | `version()` Version of the entity.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### version

          public final String version()

      Description copied from interface: `EntityState`
      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.

      Specified by:
        `version` in interface `EntityState`
      Returns:
        version of the entity

    - #### lastModified

          public long lastModified()

      Description copied from interface: `EntityState`
      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.

      Specified by:
        `lastModified` in interface `EntityState`
      Returns:
        last modified timestamp of the entity, as defined by System.currentTimeMillis()

    - #### identity

          public EntityReference identity()

      Description copied from interface: `EntityState`
      Returns the identity of the entity that this EntityState represents.
      Specified by:
        `identity` in interface `EntityState`
      Returns:
        the identity of the entity that this EntityState represents.

    - #### propertyValueOf

          public Object propertyValueOf(QualifiedName stateName)

      Specified by:
        `propertyValueOf` in interface `EntityState`

    - #### setPropertyValue

          public void setPropertyValue(QualifiedName stateName,
                              Object newValue)

      Specified by:
        `setPropertyValue` in interface `EntityState`

    - #### associationValueOf

          public EntityReference associationValueOf(QualifiedName stateName)

      Specified by:
        `associationValueOf` in interface `EntityState`

    - #### setAssociationValue

          public void setAssociationValue(QualifiedName stateName,
                                 EntityReference newEntity)

      Specified by:
        `setAssociationValue` in interface `EntityState`

    - #### manyAssociationValueOf

          public ManyAssociationState manyAssociationValueOf(QualifiedName stateName)

      Specified by:
        `manyAssociationValueOf` in interface `EntityState`

    - #### namedAssociationValueOf

          public NamedAssociationState namedAssociationValueOf(QualifiedName stateName)

      Specified by:
        `namedAssociationValueOf` in interface `EntityState`

    - #### remove

          public void remove()

      Description copied from interface: `EntityState`
      Remove the entity represented by this EntityState when the unit of work is completed.
      Specified by:
        `remove` in interface `EntityState`

    - #### status

          public EntityStatus status()

      Description copied from interface: `EntityState`
      The status of this EntityState
      Specified by:
        `status` in interface `EntityState`
      Returns:
        the status

    - #### isAssignableTo

          public boolean isAssignableTo(Class<?> type)

      Specified by:
        `isAssignableTo` in interface `EntityState`

    - #### entityDescriptor

          public EntityDescriptor entityDescriptor()

      Specified by:
        `entityDescriptor` in interface `EntityState`

    - #### state

          public JSONObject state()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### markUpdated

          public void markUpdated()