Class AutoPopulatedEntityEventListener
java.lang.Object
io.micronaut.data.runtime.event.listeners.AutoPopulatedEntityEventListener
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,EntityEventListener<Object>
,EventListener
- Direct Known Subclasses:
AutoTimestampEntityEventListener
,TenantIdEntityEventListener
,UUIDGeneratingEntityEventListener
public abstract class AutoPopulatedEntityEventListener
extends Object
implements EntityEventListener<Object>
Abstract implementation of a listener that handles
AutoPopulated
.- Since:
- 2.3.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.data.event.EntityEventListener
NOOP
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected @NonNull RuntimePersistentProperty<Object>[]
Returns the applicable properties for this listener.protected abstract @NonNull List<Class<? extends Annotation>>
protected abstract @NonNull Predicate<RuntimePersistentProperty<Object>>
final boolean
supports
(RuntimePersistentEntity<Object> entity, Class<? extends Annotation> eventType) Allows including or excluding a listener for a specific entity.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.data.event.EntityEventListener
postLoad, postPersist, postRemove, postUpdate, prePersist, preQuery, preRemove, preUpdate
Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Constructor Details
-
AutoPopulatedEntityEventListener
public AutoPopulatedEntityEventListener()
-
-
Method Details
-
supports
public final boolean supports(RuntimePersistentEntity<Object> entity, Class<? extends Annotation> eventType) Description copied from interface:EntityEventListener
Allows including or excluding a listener for a specific entity.- Specified by:
supports
in interfaceEntityEventListener<Object>
- Parameters:
entity
- The entityeventType
- The event type- Returns:
- True if it is supported
-
getEventTypes
- Returns:
- The event type
-
getPropertyPredicate
@NonNull protected abstract @NonNull Predicate<RuntimePersistentProperty<Object>> getPropertyPredicate()- Returns:
- A predicate to apply for the given property.
-
getApplicableProperties
@NonNull protected @NonNull RuntimePersistentProperty<Object>[] getApplicableProperties(RuntimePersistentEntity<Object> entity) Returns the applicable properties for this listener.- Parameters:
entity
- The entity- Returns:
- the properties
-