Package com.oracle.coherence.cdi.events
Class AnnotatedMapListener<K,V>
- java.lang.Object
-
- com.oracle.coherence.cdi.events.AnnotatedMapListener<K,V>
-
- Type Parameters:
K
- the type of the map entry keysV
- the type of the map entry values
- All Implemented Interfaces:
MapListener<K,V>
,Comparable<AnnotatedMapListener<?,?>>
,EventListener
public class AnnotatedMapListener<K,V> extends Object implements MapListener<K,V>, Comparable<AnnotatedMapListener<?,?>>
MapListener
implementation that dispatchesMapEvent
s to a CDI observer.- Since:
- 20.06
- Author:
- Aleks Seovic 2020.04.14
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AnnotatedMapListener.FilterProducer
A producer ofFilter
instances.static interface
AnnotatedMapListener.MapEventObserver<K,V>
static interface
AnnotatedMapListener.MapEventTransformerProducer
A producer ofMapEventTransformer
instances.
-
Field Summary
Fields Modifier and Type Field Description static String
WILD_CARD
The wild-card value for cache and service names;-
Fields inherited from interface com.tangosol.util.MapListener
ASYNCHRONOUS, SYNCHRONOUS, VERSION_AWARE
-
-
Constructor Summary
Constructors Constructor Description AnnotatedMapListener(AnnotatedMapListener.MapEventObserver<K,V> observer, Set<Annotation> annotations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(AnnotatedMapListener<?,?> other)
void
entryDeleted(MapEvent<K,V> event)
Invoked when a map entry has been removed.void
entryInserted(MapEvent<K,V> event)
Invoked when a map entry has been inserted.void
entryUpdated(MapEvent<K,V> event)
Invoked when a map entry has been updated.String
getCacheName()
Return the name of the cache this listener is for, or'*'
if it should be registered regardless of the cache name.Filter<?>
getFilter()
Obtain theFilter
that should be used when registering this listener.String
getScopeName()
Return the name of the scope this listener is for, ornull
if it should be registered regardless of the scope name.String
getServiceName()
Return the name of the service this listener is for, or'*'
if it should be registered regardless of the service name.String
getSessionName()
Return the name of the session that this listener is forMapEventTransformer
getTransformer()
Obtain theMapEventTransformer
that should be used when registering this listener.boolean
hasFilterAnnotation()
Returnstrue
if this listener has a filter annotation to resolve.boolean
hasTransformerAnnotation()
Returnstrue
if this listener has a transformer annotation to resolve.boolean
isLite()
Returntrue
if this is lite event listener.boolean
isSynchronous()
Returntrue
if this is synchronous event listener.boolean
isWildCardCacheName()
Returntrue
if this listener is for a wild-card cache name.boolean
isWildCardServiceName()
Returntrue
if this listener is for a wild-card cache name.void
resolveFilter(AnnotatedMapListener.FilterProducer producer)
Resolve this listener's filter annotation into aFilter
instance.void
resolveTransformer(AnnotatedMapListener.MapEventTransformerProducer producer)
Resolve this listener's transformer annotation into aMapEventTransformer
instance.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tangosol.util.MapListener
characteristics, isAsynchronous, isVersionAware, synchronous
-
-
-
-
Field Detail
-
WILD_CARD
public static final String WILD_CARD
The wild-card value for cache and service names;- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AnnotatedMapListener
public AnnotatedMapListener(AnnotatedMapListener.MapEventObserver<K,V> observer, Set<Annotation> annotations)
-
-
Method Detail
-
entryInserted
public void entryInserted(MapEvent<K,V> event)
Description copied from interface:MapListener
Invoked when a map entry has been inserted.- Specified by:
entryInserted
in interfaceMapListener<K,V>
- Parameters:
event
- the MapEvent carrying the insert information
-
entryUpdated
public void entryUpdated(MapEvent<K,V> event)
Description copied from interface:MapListener
Invoked when a map entry has been updated.- Specified by:
entryUpdated
in interfaceMapListener<K,V>
- Parameters:
event
- the MapEvent carrying the update information
-
entryDeleted
public void entryDeleted(MapEvent<K,V> event)
Description copied from interface:MapListener
Invoked when a map entry has been removed.- Specified by:
entryDeleted
in interfaceMapListener<K,V>
- Parameters:
event
- the MapEvent carrying the delete information
-
compareTo
public int compareTo(AnnotatedMapListener<?,?> other)
- Specified by:
compareTo
in interfaceComparable<K>
-
getSessionName
public String getSessionName()
Return the name of the session that this listener is for- Returns:
- the name of the session this listener is for
-
hasFilterAnnotation
public boolean hasFilterAnnotation()
Returnstrue
if this listener has a filter annotation to resolve.- Returns:
true
if this listener has a filter annotation to resolve
-
resolveFilter
public void resolveFilter(AnnotatedMapListener.FilterProducer producer)
Resolve this listener's filter annotation into aFilter
instance.If this listener's filter has already been resolved this operation is a no-op.
- Parameters:
producer
- theAnnotatedMapListener.FilterProducer
to use to resolve theFilter
-
hasTransformerAnnotation
public boolean hasTransformerAnnotation()
Returnstrue
if this listener has a transformer annotation to resolve.- Returns:
true
if this listener has a transformer annotation to resolve
-
resolveTransformer
public void resolveTransformer(AnnotatedMapListener.MapEventTransformerProducer producer)
Resolve this listener's transformer annotation into aMapEventTransformer
instance.If this listener's transformer has already been resolved this method is a no-op
- Parameters:
producer
- theAnnotatedMapListener.MapEventTransformerProducer
to use to resolve theMapEventTransformer
-
getFilter
public Filter<?> getFilter()
Obtain theFilter
that should be used when registering this listener.- Returns:
- the
Filter
that should be used when registering this listener
-
getTransformer
public MapEventTransformer getTransformer()
Obtain theMapEventTransformer
that should be used when registering this listener.- Returns:
- the
MapEventTransformer
that should be used when registering this listener
-
getCacheName
public String getCacheName()
Return the name of the cache this listener is for, or'*'
if it should be registered regardless of the cache name.- Returns:
- the name of the cache this listener is for
-
isWildCardCacheName
public boolean isWildCardCacheName()
Returntrue
if this listener is for a wild-card cache name.- Returns:
true
if this listener is for a wild-card cache name
-
getServiceName
public String getServiceName()
Return the name of the service this listener is for, or'*'
if it should be registered regardless of the service name.- Returns:
- the name of the cache this listener is for
-
isWildCardServiceName
public boolean isWildCardServiceName()
Returntrue
if this listener is for a wild-card cache name.- Returns:
true
if this listener is for a wild-card cache name
-
getScopeName
public String getScopeName()
Return the name of the scope this listener is for, ornull
if it should be registered regardless of the scope name.- Returns:
- the name of the cache this listener is for
-
isLite
public boolean isLite()
Returntrue
if this is lite event listener.- Returns:
true
if this is lite event listener
-
isSynchronous
public boolean isSynchronous()
Returntrue
if this is synchronous event listener.- Specified by:
isSynchronous
in interfaceMapListener<K,V>
- Returns:
true
if this is synchronous event listener
-
-