Package io.jmix.data

Interface AttributeChangesProvider

All Known Implementing Classes:
BaseAttributeChangesProvider, EclipselinkAttributeChangesProvider

public interface AttributeChangesProvider
Provides information about changes in entity attributes.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an object describing changes in entity attributes.
    Returns the set of dirty attributes (changed since the last load from the database).
    getOldValue(Object entity, String attribute)
    Returns an old value of an attribute changed in the current transaction.
    boolean
    isChanged(Object entity)
    Returns true if the given entity has dirty attributes (changed since the last load from the database).
    boolean
    isChanged(Object entity, String... attributes)
    Returns true if at least one of the given attributes is dirty (i.e.
  • Method Details

    • getAttributeChanges

      AttributeChanges getAttributeChanges(Object entity)
      Returns an object describing changes in entity attributes.
      Parameters:
      entity - entity instance
      Returns:
      dirty attribute names
    • getChangedAttributeNames

      Set<String> getChangedAttributeNames(Object entity)
      Returns the set of dirty attributes (changed since the last load from the database).

      If the entity is new, returns all its attributes.

      If the entity is not persistent or not in the Managed state, returns empty set.

      Parameters:
      entity - entity instance
      Returns:
      dirty attribute names
      See Also:
    • isChanged

      boolean isChanged(Object entity)
      Returns true if the given entity has dirty attributes (changed since the last load from the database).
      If the entity is new, returns true.
      If the entity is not persistent or not in the Managed state, returns false.
      Parameters:
      entity - entity instance
      See Also:
    • isChanged

      boolean isChanged(Object entity, String... attributes)
      Returns true if at least one of the given attributes is dirty (i.e. changed since the last load from the database).

      If the entity is new, always returns true.

      If the entity is not persistent or not in the Managed state, always returns false.

      Parameters:
      entity - entity instance
      attributes - attributes to check
      See Also:
    • getOldValue

      @Nullable Object getOldValue(Object entity, String attribute)
      Returns an old value of an attribute changed in the current transaction. The entity must be in the Managed state. For enum attributes returns enum value.
      You can check if the value has been changed using isChanged(Object, String...) method.
      Parameters:
      entity - entity instance
      attribute - attribute name
      Returns:
      an old value stored in the database. For a new entity returns null.
      Throws:
      IllegalArgumentException - if the entity is not persistent or not in the Managed state
      See Also: