Package org.ehcache.config.builders
Class CacheEventListenerConfigurationBuilder
java.lang.Object
org.ehcache.config.builders.CacheEventListenerConfigurationBuilder
- All Implemented Interfaces:
org.ehcache.config.Builder<org.ehcache.core.events.CacheEventListenerConfiguration<?>>
public class CacheEventListenerConfigurationBuilder
extends Object
implements org.ehcache.config.Builder<org.ehcache.core.events.CacheEventListenerConfiguration<?>>
The
CacheEventListenerConfigurationBuilder enables building CacheEventListenerConfigurations using a
fluent style.
As with all Ehcache builders, all instances are immutable and calling any method on the builder will return a new instance without modifying the one on which the method was called. This enables the sharing of builder instances without any risk of seeing them modified by code elsewhere.
-
Method Summary
Modifier and TypeMethodDescriptionSets the returned builder for asynchronous event processing.org.ehcache.impl.config.event.DefaultCacheEventListenerConfigurationbuild()Builds theCacheEventListenerConfigurationthis builder represents.constructedWith(Object... arguments) Adds arguments that will be passed to the constructor of theCacheEventListenersubclass configured previously.eventOrdering(org.ehcache.event.EventOrdering eventOrdering) Adds specificEventOrderingto the returned builder.firingMode(org.ehcache.event.EventFiring eventFiringMode) Adds specificEventFiringto the returned builder.newEventListenerConfiguration(Class<? extends org.ehcache.event.CacheEventListener<?, ?>> listenerClass, Set<org.ehcache.event.EventType> eventSetToFireOn) Creates a new builder instance using the givenCacheEventListenersubclass and the set ofEventTypes to listen to.newEventListenerConfiguration(Class<? extends org.ehcache.event.CacheEventListener<?, ?>> listenerClass, org.ehcache.event.EventType eventType, org.ehcache.event.EventType... eventTypes) Creates a new builder instance using the givenCacheEventListenersubclass and theEventTypes it will listen to.newEventListenerConfiguration(org.ehcache.event.CacheEventListener<?, ?> listener, Set<org.ehcache.event.EventType> eventSetToFireOn) Creates a new builder instance using the givenCacheEventListenerinstance and the set ofEventTypes to listen to.newEventListenerConfiguration(org.ehcache.event.CacheEventListener<?, ?> listener, org.ehcache.event.EventType eventType, org.ehcache.event.EventType... eventTypes) Creates a new builder instance using the givenCacheEventListenerinstance and theEventTypes it will listen to.ordered()Sets the returned builder for ordered event processing.Sets the returned builder for synchronous event processing.Sets the returned builder for unordered event processing.
-
Method Details
-
newEventListenerConfiguration
public static CacheEventListenerConfigurationBuilder newEventListenerConfiguration(Class<? extends org.ehcache.event.CacheEventListener<?, ?>> listenerClass, org.ehcache.event.EventType eventType, org.ehcache.event.EventType... eventTypes) Creates a new builder instance using the givenCacheEventListenersubclass and theEventTypes it will listen to.EventOrderingdefaults toEventOrdering.UNORDEREDEventFiringdefaults toEventFiring.ASYNCHRONOUS
- Parameters:
listenerClass- theCacheEventListenersubclasseventType- the mandatory event type to listen toeventTypes- optional additional event types to listen to- Returns:
- the new builder instance
-
newEventListenerConfiguration
public static CacheEventListenerConfigurationBuilder newEventListenerConfiguration(org.ehcache.event.CacheEventListener<?, ?> listener, org.ehcache.event.EventType eventType, org.ehcache.event.EventType... eventTypes) Creates a new builder instance using the givenCacheEventListenerinstance and theEventTypes it will listen to.EventOrderingdefaults toEventOrdering.UNORDEREDEventFiringdefaults toEventFiring.ASYNCHRONOUS
- Parameters:
listener- theCacheEventListenerinstanceeventType- the mandatory event type to listen toeventTypes- optional additional event types to listen to- Returns:
- the new builder instance
-
newEventListenerConfiguration
public static CacheEventListenerConfigurationBuilder newEventListenerConfiguration(Class<? extends org.ehcache.event.CacheEventListener<?, ?>> listenerClass, Set<org.ehcache.event.EventType> eventSetToFireOn) throws IllegalArgumentExceptionCreates a new builder instance using the givenCacheEventListenersubclass and the set ofEventTypes to listen to.EventOrderingdefaults toEventOrdering.UNORDEREDEventFiringdefaults toEventFiring.ASYNCHRONOUS
- Parameters:
listenerClass- theCacheEventListenersubclasseventSetToFireOn- the set of events to listen to, cannot be empty- Returns:
- the new builder instance
- Throws:
IllegalArgumentException- if theeventSetToFireOnis empty
-
newEventListenerConfiguration
public static CacheEventListenerConfigurationBuilder newEventListenerConfiguration(org.ehcache.event.CacheEventListener<?, ?> listener, Set<org.ehcache.event.EventType> eventSetToFireOn) throws IllegalArgumentExceptionCreates a new builder instance using the givenCacheEventListenerinstance and the set ofEventTypes to listen to.EventOrderingdefaults toEventOrdering.UNORDEREDEventFiringdefaults toEventFiring.ASYNCHRONOUS
- Parameters:
listener- theCacheEventListenerinstanceeventSetToFireOn- the set of events to listen to, cannot be empty- Returns:
- the new builder instance
- Throws:
IllegalArgumentException- if theeventSetToFireOnis empty
-
constructedWith
Adds arguments that will be passed to the constructor of theCacheEventListenersubclass configured previously.- Parameters:
arguments- the constructor arguments- Returns:
- a new builder with the added constructor arguments
- Throws:
IllegalArgumentException- if this builder is instance based
-
eventOrdering
public CacheEventListenerConfigurationBuilder eventOrdering(org.ehcache.event.EventOrdering eventOrdering) Adds specificEventOrderingto the returned builder.EventOrderingdefaults toEventOrdering.UNORDERED
- Parameters:
eventOrdering- theEventOrderingto use- Returns:
- a new builder with the specified event ordering
- See Also:
-
ordered
Sets the returned builder for ordered event processing.- Returns:
- a new builder for ordered processing
- See Also:
-
unordered
Sets the returned builder for unordered event processing.- Returns:
- a new builder for unordered processing
- See Also:
-
firingMode
public CacheEventListenerConfigurationBuilder firingMode(org.ehcache.event.EventFiring eventFiringMode) Adds specificEventFiringto the returned builder.EventFiringdefaults toEventFiring.ASYNCHRONOUS
- Parameters:
eventFiringMode- theEventFiringto use- Returns:
- a new builder with the specified event firing
- See Also:
-
synchronous
Sets the returned builder for synchronous event processing.- Returns:
- a new builder for synchronous processing
- See Also:
-
asynchronous
Sets the returned builder for asynchronous event processing.- Returns:
- a new builder for asynchronous processing
- See Also:
-
build
public org.ehcache.impl.config.event.DefaultCacheEventListenerConfiguration build()Builds theCacheEventListenerConfigurationthis builder represents.- Specified by:
buildin interfaceorg.ehcache.config.Builder<org.ehcache.core.events.CacheEventListenerConfiguration<?>>- Returns:
- the
CacheEventListenerConfiguration
-