Interface Resource


public interface Resource
A Resource is a collection of messages for a particular software component and locale. It is loaded from an XML file whose root element is <BaflResourceList>.

Given such an XML file, ResourceGen can generate Java a wrapper class which implements this interface, and also has a method to create an error for each message.

Since:
3 December, 2001
Version:
$Id: //open/util/resgen/src/org/eigenbase/resgen/Resource.java#4 $
Author:
jhyde
  • Field Details

  • Method Details

    • init

      void init(URL url, Locale locale) throws IOException
      Populates this Resource from a URL.
      Parameters:
      url - The URL of the XML file containing the error messages
      locale - The ISO locale code (e.g. "en", or "en_US", or "en_US_WIN") of the messages
      Throws:
      IOException - if url cannot be opened, or if the format of its contents are invalid
      IOException
    • init

      void init(ResourceDef.ResourceBundle resourceList, Locale locale)
      Populates this Resource from an XML document.
      Parameters:
      resourceList - The URL of the XML file containing the error messages
      locale - The ISO locale code (e.g. "en", or "en_US", or "en_US_WIN") of the messages
    • getLocale

      Locale getLocale()
      Returns the locale of the messages.
    • formatError

      String formatError(int code, Object[] args)
      Formats the message corresponding to code with the given arguments. If an argument is not supplied, the tokens remain in the returned message string.
    • getSeverity

      int getSeverity(int code)
      Returns the severity of this message.