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 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 given CacheEventListener subclass and the EventTypes it will listen to.

      • EventOrdering defaults to EventOrdering.UNORDERED
      • EventFiring defaults to EventFiring.ASYNCHRONOUS
      Parameters:
      listenerClass - the CacheEventListener subclass
      eventType - the mandatory event type to listen to
      eventTypes - 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 given CacheEventListener instance and the EventTypes it will listen to.

      • EventOrdering defaults to EventOrdering.UNORDERED
      • EventFiring defaults to EventFiring.ASYNCHRONOUS
      Parameters:
      listener - the CacheEventListener instance
      eventType - the mandatory event type to listen to
      eventTypes - 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 IllegalArgumentException
      Creates a new builder instance using the given CacheEventListener subclass and the set of EventTypes to listen to.

      • EventOrdering defaults to EventOrdering.UNORDERED
      • EventFiring defaults to EventFiring.ASYNCHRONOUS
      Parameters:
      listenerClass - the CacheEventListener subclass
      eventSetToFireOn - the set of events to listen to, cannot be empty
      Returns:
      the new builder instance
      Throws:
      IllegalArgumentException - if the eventSetToFireOn is empty
    • newEventListenerConfiguration

      public static CacheEventListenerConfigurationBuilder newEventListenerConfiguration(org.ehcache.event.CacheEventListener<?,?> listener, Set<org.ehcache.event.EventType> eventSetToFireOn) throws IllegalArgumentException
      Creates a new builder instance using the given CacheEventListener instance and the set of EventTypes to listen to.

      • EventOrdering defaults to EventOrdering.UNORDERED
      • EventFiring defaults to EventFiring.ASYNCHRONOUS
      Parameters:
      listener - the CacheEventListener instance
      eventSetToFireOn - the set of events to listen to, cannot be empty
      Returns:
      the new builder instance
      Throws:
      IllegalArgumentException - if the eventSetToFireOn is empty
    • constructedWith

      public CacheEventListenerConfigurationBuilder constructedWith(Object... arguments)
      Adds arguments that will be passed to the constructor of the CacheEventListener subclass 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 specific EventOrdering to the returned builder.

      • EventOrdering defaults to EventOrdering.UNORDERED
      Parameters:
      eventOrdering - the EventOrdering to 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 specific EventFiring to the returned builder.

      • EventFiring defaults to EventFiring.ASYNCHRONOUS
      Parameters:
      eventFiringMode - the EventFiring to 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 the CacheEventListenerConfiguration this builder represents.
      Specified by:
      build in interface org.ehcache.config.Builder<org.ehcache.core.events.CacheEventListenerConfiguration<?>>
      Returns:
      the CacheEventListenerConfiguration