Class DiscoverNamesInDictionary

java.lang.Object
org.apache.commons.discovery.resource.names.ResourceNameDiscoverImpl
org.apache.commons.discovery.resource.names.DiscoverNamesInDictionary
All Implemented Interfaces:
ResourceNameDiscover

public class DiscoverNamesInDictionary extends ResourceNameDiscoverImpl implements ResourceNameDiscover
Recover resources from a Dictionary. This covers Properties as well, since Properties extends Hashtable extends Dictionary. The recovered value is expected to be either a String or a String[].
  • Field Details

    • log

      private static org.apache.commons.logging.Log log
    • dictionary

      private Dictionary<String,String[]> dictionary
  • Constructor Details

    • DiscoverNamesInDictionary

      public DiscoverNamesInDictionary()
      Construct a new resource discoverer with an empty Dictionary.
    • DiscoverNamesInDictionary

      public DiscoverNamesInDictionary(Dictionary<String,String[]> dictionary)
      Construct a new resource discoverer with the given Dictionary.
      Parameters:
      dictionary - The initial Dictionary
  • Method Details

    • setLog

      @Deprecated public static void setLog(org.apache.commons.logging.Log _log)
      Deprecated.
      This method is not thread-safe
      Sets the Log for this class.
      Parameters:
      _log - This class Log
    • getDictionary

      protected Dictionary<String,String[]> getDictionary()
      Returns the current Dictionary for names mapping.
      Returns:
      The current Dictionary for names mapping
    • setDictionary

      public void setDictionary(Dictionary<String,String[]> table)
      Specify the Dictionary for names mapping.
      Parameters:
      table - The Dictionary for names mapping
    • addResource

      public void addResource(String resourceName, String resource)
      Add a resource name to a single name mapping.
      Parameters:
      resourceName - The resource name
      resource - The target name
    • addResource

      public void addResource(String resourceName, String[] resources)
      Add a resource name to multiple names mapping.
      Parameters:
      resourceName - The resource name
      resources - The target names
    • findResourceNames

      public ResourceNameIterator findResourceNames(String resourceName)
      Locate names of resources that are bound to resourceName.
      Specified by:
      findResourceNames in interface ResourceNameDiscover
      Specified by:
      findResourceNames in class ResourceNameDiscoverImpl
      Parameters:
      resourceName - The resource name to locate
      Returns:
      A new ResourceNameIterator