Class LoggingMap<KEY,VALUE>

java.lang.Object
com.ardor3d.extension.animation.skeletal.util.LoggingMap<KEY,VALUE>
Direct Known Subclasses:
ImportClipMap, OutputClipSourceMap

public class LoggingMap<KEY,VALUE> extends Object
This class essentially just wraps a KEY/VALUE HashMap, providing extra logging when a VALUE is not found, or duplicate VALUE objects are added. An optional callback may be provided to try to load values not present in this map. These are loaded using the string representation of the key and casting the return from Object to the value class. If the value is still null, a default value is returned.
  • Field Details

    • _wrappedMap

      protected final Map<KEY,VALUE> _wrappedMap
      Our map of values.
  • Constructor Details

    • LoggingMap

      public LoggingMap()
  • Method Details

    • put

      public void put(KEY key, VALUE value)
      Add a value to the store. Logs a warning if a value by the same key was already in the store and logOnReplace is true.
      Parameters:
      key - the key to add.
      value - the value to add.
    • get

      public VALUE get(KEY key)
      Retrieves a value from our store by key. Logs a warning if a value by that key is not found and logOnMissing is true. If missing, defaultValue is returned.
      Parameters:
      key - the key of the value to find.
      Returns:
      the associated value, or null if none is found.
    • remove

      public VALUE remove(KEY key)
      Removes the mapping for the given key.
      Parameters:
      key - the key of the value to remove.
      Returns:
      the previously associated value, or null if none was found.
    • size

      public int size()
      Returns:
      the number of key-value pairs stored in this object.
    • setDefaultValue

      public void setDefaultValue(VALUE defaultValue)
    • getDefaultValue

      public VALUE getDefaultValue()
    • setLogOnReplace

      public void setLogOnReplace(boolean logOnReplace)
    • isLogOnReplace

      public boolean isLogOnReplace()
    • setLogOnMissing

      public void setLogOnMissing(boolean logOnMissing)
    • isLogOnMissing

      public boolean isLogOnMissing()
    • getMissCallback

      public MissingCallback<KEY,VALUE> getMissCallback()
    • setMissCallback

      public void setMissCallback(MissingCallback<KEY,VALUE> missCallback)
    • keySet

      public Set<KEY> keySet()
    • values

      public Collection<VALUE> values()