Class MapStoreAction<K>

java.lang.Object
monq.jfa.actions.MapStoreAction<K>
Type Parameters:
K - type of key to use in the map
All Implemented Interfaces:
Action

public class MapStoreAction<K> extends Object implements Action
The action, when called, will call the bi-consumer defined in the constructor with the key defined there and the current match. In many cases, the bi-consumer can be the put() operation of a Map. If this action is called multiple times, it is up to the bi-consumer to decide how to handle this, e.g. by replacing the mapping with the new match or by appending it to a list.
  • Constructor Details

    • MapStoreAction

      public MapStoreAction(K key, BiConsumer<K,String> store)
      Creates the action.
      Parameters:
      key - to used to store the match.
      store - a bi-consumer which most likely should be shared between several MapStoreAction objects with differing keys.
  • Method Details

    • invoke

      public void invoke(StringBuilder out, int start)
      Description copied from interface: Action
      Will be called with new data appended to the given StringBuilder. The method is free to work in any way with the whole text content, not only the new part demarcated by the start parameter.
      Specified by:
      invoke in interface Action
      Parameters:
      out - contains new data at its end
      start - where the new data starts