Class TenantIdEntityEventListener
java.lang.Object
io.micronaut.data.runtime.event.listeners.AutoPopulatedEntityEventListener
io.micronaut.data.runtime.event.listeners.TenantIdEntityEventListener
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,io.micronaut.data.event.EntityEventListener<Object>,io.micronaut.data.model.runtime.PropertyAutoPopulator<io.micronaut.data.annotation.TenantId>,EventListener
@Requires(beans=TenantResolver.class)
@Singleton
public class TenantIdEntityEventListener
extends AutoPopulatedEntityEventListener
implements io.micronaut.data.model.runtime.PropertyAutoPopulator<io.micronaut.data.annotation.TenantId>
An event listener that handles
TenantId.- Since:
- 4.8.0
-
Field Summary
Fields inherited from interface io.micronaut.data.event.EntityEventListener
NOOPFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionTenantIdEntityEventListener(TenantResolver tenantResolver, DataConversionService conversionService) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NonNull List<Class<? extends Annotation>>@NonNull Objectpopulate(io.micronaut.data.model.runtime.RuntimePersistentProperty<?> property, @Nullable Object previousValue) booleanprePersist(@NonNull io.micronaut.data.event.EntityEventContext<Object> context) Methods inherited from class io.micronaut.data.runtime.event.listeners.AutoPopulatedEntityEventListener
getApplicableProperties, supportsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.data.event.EntityEventListener
postLoad, postPersist, postRemove, postUpdate, preQuery, preRemove, preUpdateMethods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Constructor Details
-
TenantIdEntityEventListener
public TenantIdEntityEventListener(TenantResolver tenantResolver, DataConversionService conversionService) Default constructor.- Parameters:
conversionService- The conversion servicetenantResolver- The tenant resolver
-
-
Method Details
-
getEventTypes
- Specified by:
getEventTypesin classAutoPopulatedEntityEventListener- Returns:
- The event type
-
getPropertyPredicate
@NonNull protected @NonNull Predicate<io.micronaut.data.model.runtime.RuntimePersistentProperty<Object>> getPropertyPredicate()- Specified by:
getPropertyPredicatein classAutoPopulatedEntityEventListener- Returns:
- A predicate to apply for the given property.
-
prePersist
public boolean prePersist(@NonNull @NonNull io.micronaut.data.event.EntityEventContext<Object> context) - Specified by:
prePersistin interfaceio.micronaut.data.event.EntityEventListener<Object>
-
populate
@NonNull public @NonNull Object populate(io.micronaut.data.model.runtime.RuntimePersistentProperty<?> property, @Nullable @Nullable Object previousValue) - Specified by:
populatein interfaceio.micronaut.data.model.runtime.PropertyAutoPopulator<io.micronaut.data.annotation.TenantId>
-