Class AbstractMapInterceptor

java.lang.Object
com.loomcache.server.datastructures.AbstractMapInterceptor
All Implemented Interfaces:
MapInterceptor

public abstract class AbstractMapInterceptor extends Object implements MapInterceptor
No-op adapter for MapInterceptor.

Subclass this and override only the hooks you need. All default implementations pass through without modification:

Since:
1.1
See Also:
  • Constructor Details

    • AbstractMapInterceptor

      public AbstractMapInterceptor()
  • Method Details

    • interceptGet

      public String interceptGet(String mapName, String key)
      Description copied from interface: MapInterceptor
      Called before a get operation. May modify the lookup key.
      Specified by:
      interceptGet in interface MapInterceptor
      Parameters:
      mapName - the name of the distributed map
      key - the original lookup key
      Returns:
      the (possibly modified) key to use for the get; must not be null
    • interceptGetResult

      public @Nullable String interceptGetResult(String mapName, String key, @Nullable String value)
      Description copied from interface: MapInterceptor
      Called after a get operation completes. May modify the returned value.
      Specified by:
      interceptGetResult in interface MapInterceptor
      Parameters:
      mapName - the name of the distributed map
      key - the key that was looked up
      value - the value retrieved from the store, or null if absent
      Returns:
      the (possibly modified) value to return to the caller
    • interceptPut

      public @Nullable Map.Entry<String,String> interceptPut(String mapName, String key, String value)
      Description copied from interface: MapInterceptor
      Called before a put operation. May modify the key/value pair or cancel the put entirely.
      Specified by:
      interceptPut in interface MapInterceptor
      Parameters:
      mapName - the name of the distributed map
      key - the original key
      value - the original value
      Returns:
      the (possibly modified) key-value pair; return null to cancel the put
    • afterPut

      public void afterPut(String mapName, String key, String value, @Nullable String oldValue)
      Description copied from interface: MapInterceptor
      Called after a put operation completes successfully.
      Specified by:
      afterPut in interface MapInterceptor
      Parameters:
      mapName - the name of the distributed map
      key - the key that was stored
      value - the value that was stored
      oldValue - the previous value, or null if the key was new
    • interceptRemove

      public boolean interceptRemove(String mapName, String key)
      Description copied from interface: MapInterceptor
      Called before a remove operation. Return false to cancel the remove.
      Specified by:
      interceptRemove in interface MapInterceptor
      Parameters:
      mapName - the name of the distributed map
      key - the key to be removed
      Returns:
      true to proceed with the remove, false to cancel it
    • afterRemove

      public void afterRemove(String mapName, String key, @Nullable String oldValue)
      Description copied from interface: MapInterceptor
      Called after a remove operation completes (only when an entry was actually removed).
      Specified by:
      afterRemove in interface MapInterceptor
      Parameters:
      mapName - the name of the distributed map
      key - the key that was removed
      oldValue - the value that was removed, or null if the key was not present