public class AttributeChanges
extends java.lang.Object
EntityChangedEvent.getChanges()| Modifier and Type | Class and Description |
|---|---|
static class |
AttributeChanges.Change
INTERNAL.
|
| Constructor and Description |
|---|
AttributeChanges(java.util.Set<AttributeChanges.Change> changes,
java.util.Map<java.lang.String,AttributeChanges> embeddedChanges)
INTERNAL.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.lang.String> |
getAttributes()
Returns names of changed attributes for the root entity and all its embedded entities (if any).
|
<E extends Entity<K>,K> |
getOldCollection(java.lang.String attributeName,
java.lang.Class<E> entityClass)
Type-safe method of getting the old value of a collection attribute.
|
<E extends Entity<K>,K> |
getOldReferenceId(java.lang.String attributeName)
Type-safe method of getting the old value of a reference attribute.
|
<T> T |
getOldValue(java.lang.String attributeName)
Returns old value of a changed attribute with the given name.
|
java.util.Set<java.lang.String> |
getOwnAttributes()
Returns names of changed attributes for the root entity.
|
boolean |
isChanged(java.lang.String attributeName)
Returns true if an attribute with the given name is changed.
|
java.lang.String |
toString() |
public AttributeChanges(java.util.Set<AttributeChanges.Change> changes, java.util.Map<java.lang.String,AttributeChanges> embeddedChanges)
public java.util.Set<java.lang.String> getOwnAttributes()
public java.util.Set<java.lang.String> getAttributes()
public boolean isChanged(java.lang.String attributeName)
@Nullable public <T> T getOldValue(java.lang.String attributeName)
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 of Ids.
@Nullable public <E extends Entity<K>,K> Id<E,K> getOldReferenceId(java.lang.String attributeName)
attributeName - reference attribute namepublic <E extends Entity<K>,K> java.util.Collection<Id<E,K>> getOldCollection(java.lang.String attributeName, java.lang.Class<E> entityClass)
Usage example:
Collection<Id<OrderLine, UUID>> orderLines = event.getChanges().getOldCollection("orderLines", OrderLine.class);
for (Id<OrderLine, UUID> orderLineId : orderLines) {
OrderLine orderLine = dataManager.load(orderLineId).one();
// ...
}
attributeName - collection attribute nameentityClass - class of the attributepublic java.lang.String toString()
toString in class java.lang.Object