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 TypeMethodDescriptiongetAttributeChanges
(Object entity) Returns an object describing changes in entity attributes.getChangedAttributeNames
(Object entity) 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
Returns true if the given entity has dirty attributes (changed since the last load from the database).boolean
Returns true if at least one of the given attributes is dirty (i.e.
-
Method Details
-
getAttributeChanges
Returns an object describing changes in entity attributes.- Parameters:
entity
- entity instance- Returns:
- dirty attribute names
-
getChangedAttributeNames
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
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
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 instanceattributes
- attributes to check- See Also:
-
getOldValue
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 usingisChanged(Object, String...)
method.- Parameters:
entity
- entity instanceattribute
- 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:
-