org.infinispan.cdi.embedded.event.cache.CacheEntryRemovedAdapter Maven / Gradle / Ivy
package org.infinispan.cdi.embedded.event.cache;
import javax.enterprise.event.Event;
import javax.enterprise.util.TypeLiteral;
import org.infinispan.Cache;
import org.infinispan.metadata.Metadata;
import org.infinispan.notifications.Listener;
import org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved;
import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent;
import org.infinispan.transaction.xa.GlobalTransaction;
/**
* Event bridge for {@link org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved}.
*
* @author Pete Muir
* @author Sebastian Laskawiec
* @see org.infinispan.notifications.Listener
* @see org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved
*/
@Listener
public class CacheEntryRemovedAdapter extends AbstractAdapter> {
/**
* CDI does not allow parametrized type for events (like
). This is why this wrapped needs to be
* introduced. To ensure type safety, this needs to be linked to parent class (in other words this class can not
* be static).
*/
private class CDICacheEntryRemovedEvent implements CacheEntryRemovedEvent {
private CacheEntryRemovedEvent decoratedEvent;
private CDICacheEntryRemovedEvent(CacheEntryRemovedEvent decoratedEvent) {
this.decoratedEvent = decoratedEvent;
}
@Override
public V getValue() {
return decoratedEvent.getValue();
}
@Override
public V getOldValue() {
return decoratedEvent.getOldValue();
}
@Override
public boolean isCommandRetried() {
return decoratedEvent.isCommandRetried();
}
@Override
public K getKey() {
return decoratedEvent.getKey();
}
@Override
public Metadata getMetadata() {
return decoratedEvent.getMetadata();
}
@Override
public GlobalTransaction getGlobalTransaction() {
return decoratedEvent.getGlobalTransaction();
}
@Override
public boolean isOriginLocal() {
return decoratedEvent.isOriginLocal();
}
@Override
public Type getType() {
return decoratedEvent.getType();
}
@Override
public boolean isPre() {
return decoratedEvent.isPre();
}
@Override
public Cache getCache() {
return decoratedEvent.getCache();
}
}
/**
* Needed for creating event bridge.
*/
public static final CacheEntryRemovedEvent, ?> EMPTY = new CacheEntryRemovedEvent
© 2015 - 2025 Weber Informatics LLC | Privacy Policy