Class MetadataImpl

java.lang.Object
org.jppf.utils.collections.MetadataImpl
All Implemented Interfaces:
Serializable, Metadata
Direct Known Subclasses:
JPPFJobMetadata, JPPFTaskBundle, MemoryMapDataProvider

public class MetadataImpl extends Object implements Metadata
An implementation of the Metadata interface backed by a Hashtable.
Author:
Laurent Cohen
See Also:
  • Field Details

    • parameters

      protected final Map<Object,Object> parameters
      The map holding the mapping of keys to values.
  • Constructor Details

    • MetadataImpl

      public MetadataImpl()
  • Method Details

    • getParameter

      public <T> T getParameter(Object key)
      Description copied from interface: Metadata
      Retrieve a parameter in the metadata.
      Specified by:
      getParameter in interface Metadata
      Type Parameters:
      T - the type of the value to get.
      Parameters:
      key - the parameter's key.
      Returns:
      the parameter's value or null if no parameter with the specified key exists.
    • getParameter

      public <T> T getParameter(Object key, T defaultValue)
      Description copied from interface: Metadata
      Retrieve a parameter in the metadata.
      Specified by:
      getParameter in interface Metadata
      Type Parameters:
      T - the type of the value to get.
      Parameters:
      key - the parameter's key.
      defaultValue - a default value to return if no parameter with the specified key can be found.
      Returns:
      the parameter's value or null if no parameter with the specified key exists.
    • setParameter

      public Metadata setParameter(Object key, Object value)
      Description copied from interface: Metadata
      Set a parameter in the metadata. If a parameter with the same key already exists, its value is replaced with the new one.
      Specified by:
      setParameter in interface Metadata
      Parameters:
      key - the parameter's key.
      value - the parameter's value.
      Returns:
      this metadata object, for method chaining.
    • removeParameter

      public <T> T removeParameter(Object key)
      Description copied from interface: Metadata
      Remove a parameter from the metadata.
      Specified by:
      removeParameter in interface Metadata
      Type Parameters:
      T - the type of the value to remove.
      Parameters:
      key - the parameter's key.
      Returns:
      the removed parameter's value or null if no parameter with the specified key exists.
    • hasParameter

      public boolean hasParameter(Object key)
      Description copied from interface: Metadata
      Determine whether this metadata container has a parameter with the specified key.
      Specified by:
      hasParameter in interface Metadata
      Parameters:
      key - the key to lookup in this metadata container.
      Returns:
      true if this metadata has an entry with the specified key, false otherwise.
    • getAll

      public Map<Object,Object> getAll()
      Description copied from interface: Metadata
      Get a copy of the metadata map.
      Specified by:
      getAll in interface Metadata
      Returns:
      a map of the metadata contained in this object.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clear

      public Metadata clear()
      Description copied from interface: Metadata
      Clear the underlying map.
      Specified by:
      clear in interface Metadata
      Returns:
      this metadata object, for method chaining.