Class LocatorProperties

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>, LocatorLoader<Object,Object>

public class LocatorProperties extends Properties implements LocatorLoader<Object,Object>
An implementation for a map of key-value pairs that is compatible with java.util.Properties. This implementation adds a method to load properties using a string locator. The locator represents either a classpath, a URL or a file.

Sample locators:

  • file:///PATH/src/main/resources/org/jvnet/basicjaxb/locator/messages.properties
  • file:src/main/resources/org/jvnet/basicjaxb/locator/messages.properties
  • classpath:/org/jvnet/basicjaxb/locator/messages.properties
  • classpath:messages.properties
  • /PATH/src/main/resources/org/jvnet/basicjaxb/locator/messages.properties
  • src/main/resources/org/jvnet/basicjaxb/locator/messages.properties
See Also:
  • Constructor Details

    • LocatorProperties

      public LocatorProperties()
  • Method Details

    • load

      public void load(String locator) throws IOException
      Load properties for the given locator. The locator can represent a URL or a File. If the URL protocol is "classpath:" then the properties file will be located as a resource stream.
      Specified by:
      load in interface LocatorLoader<Object,Object>
      Parameters:
      locator - The location of a property file or resource.
      Throws:
      IOException - If an error occurred when inputting from the reader.