Package io.jmix.core.event
Class AttributeChanges
java.lang.Object
io.jmix.core.event.AttributeChanges
An object describing changes in entity attributes.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
INTERNAL. -
Method Summary
Modifier and TypeMethodDescriptionReturns names of changed attributes for the root entity and all its embedded entities (if any).<E> Collection<Id<E>>
getOldCollection
(String attributeName, Class<E> entityClass) Type-safe method of getting the old value of a collection attribute.<E> Id<E>
getOldReferenceId
(String attributeName) Type-safe method of getting the old value of a reference attribute.<T> T
getOldValue
(String attributeName) Returns old value of a changed attribute with the given name.Returns names of changed attributes for the root entity.boolean
boolean
Returns true if an attribute with the given name is changed.toString()
-
Method Details
-
getOwnAttributes
Returns names of changed attributes for the root entity. -
getAttributes
Returns names of changed attributes for the root entity and all its embedded entities (if any). Embedded attributes are represented by dot-separated paths. -
isChanged
Returns true if an attribute with the given name is changed. If the attribute is not changed or does not exist at all, returns false. -
getOldValue
Returns old value of a changed attribute with the given name. Old value can be null. If the attribute is not changed or does not exist at all, returns null.If the attribute is a reference to an entity, its old value is of type
Id
. If the attribute is a collection of references, its old value is a collection ofId
s. -
getOldReferenceId
Type-safe method of getting the old value of a reference attribute.- Parameters:
attributeName
- reference attribute name- Returns:
- Id of the referenced object
-
getOldCollection
Type-safe method of getting the old value of a collection attribute.Usage example:
Collection<Id<OrderLine, UUID>> orderLines = event.getChanges().getOldCollection("orderLines", OrderLine.class); for (Id<OrderLine> orderLineId : orderLines) { OrderLine orderLine = dataManager.load(orderLineId).one(); // ... }
- Parameters:
attributeName
- collection attribute nameentityClass
- class of the attribute- Returns:
- collection of Ids
-
hasChanges
public boolean hasChanges()- Returns:
- true if changes is not empty
-
toString
-