Class BasicRegistry

java.lang.Object
org.mapfish.print.servlet.registry.BasicRegistry
All Implemented Interfaces:
Registry

public class BasicRegistry extends Object implements Registry
A simple implementation of Registry based on a HashMap.
  • Constructor Details

    • BasicRegistry

      public BasicRegistry()
  • Method Details

    • setTimeToKeepAfterAccessInMinutes

      public final void setTimeToKeepAfterAccessInMinutes(int timeToKeepAfterAccessInMinutes)
    • getTimeToKeepAfterAccessInMillis

      public final long getTimeToKeepAfterAccessInMillis()
      Description copied from interface: Registry
      Return the amount of time the registry will keep an entry before purging the record. This ability to purge old records prevents the registry from growing in size indefinitely.
      Specified by:
      getTimeToKeepAfterAccessInMillis in interface Registry
      Returns:
      the number of milliseconds between the last access of a record and the time when a record can be purged from the registry.
    • delete

      public void delete(String key)
      Description copied from interface: Registry
      Delete the given key.
      Specified by:
      delete in interface Registry
      Parameters:
      key - the key to delete.
    • containsKey

      public final boolean containsKey(String key)
      Description copied from interface: Registry
      Check if something is registered for the key.
      Specified by:
      containsKey in interface Registry
      Parameters:
      key - key to check for
    • put

      public final void put(String key, URI value)
      Description copied from interface: Registry
      Put a URI in the registry.
      Specified by:
      put in interface Registry
      Parameters:
      key - the key of the entry
      value - the value
    • incrementLong

      public final long incrementLong(String key, long amount)
      Description copied from interface: Registry
      Increment the value currently stored in the registry by the amount. This assumes it is an long.

      If there is not value present in registry then a value will be registered as amount.

      Specified by:
      incrementLong in interface Registry
      Parameters:
      key - the key of the element to increment
      amount - the amount to increment
      Returns:
      the new value
    • incrementInt

      public final int incrementInt(String key, int amount)
      Description copied from interface: Registry
      Increment the value currently stored in the registry by the amount. This assumes it is an integer.

      If there is not value present in registry then a value will be registered as amount.

      Specified by:
      incrementInt in interface Registry
      Parameters:
      key - the key of the element to increment
      amount - th amount to increment
      Returns:
      the new value
    • getURI

      public final URI getURI(String key)
      Description copied from interface: Registry
      Get a URI from the registry.
      Specified by:
      getURI in interface Registry
      Parameters:
      key - the key to use for lookup.
    • put

      public final void put(String key, String value)
      Description copied from interface: Registry
      Put a string in the registry.
      Specified by:
      put in interface Registry
      Parameters:
      key - the key of the entry
      value - the value
    • getString

      public final String getString(String key)
      Description copied from interface: Registry
      Get string from the registry.
      Specified by:
      getString in interface Registry
      Parameters:
      key - the key to use for lookup.
    • put

      public final void put(String key, Number value)
      Description copied from interface: Registry
      Put a number in the registry.
      Specified by:
      put in interface Registry
      Parameters:
      key - the key of the entry
      value - the value
    • getNumber

      public final Number getNumber(String key)
      Description copied from interface: Registry
      Get a number from the registry.
      Specified by:
      getNumber in interface Registry
      Parameters:
      key - the number
    • opt

      public final <T> T opt(String key, T defaultValue)
      Description copied from interface: Registry
      Get a value from the registry or return the default if the value is not in the registry.
      Specified by:
      opt in interface Registry
      Type Parameters:
      T - the type of the returned object
      Parameters:
      key - the key of the element to the key to use for lookup.
      defaultValue - the value to return if a value with the key is not in the registry
    • put

      public final void put(String key, org.json.JSONObject value)
      Description copied from interface: Registry
      Put a json object in the registry.
      Specified by:
      put in interface Registry
      Parameters:
      key - the key of the entry
      value - the value
    • getJSON

      public final org.json.JSONObject getJSON(String key)
      Description copied from interface: Registry
      Get a json object from the registry.
      Specified by:
      getJSON in interface Registry
      Parameters:
      key - the key use for lookup