java.lang.Object
org.jdrupes.mdoclet.internal.doclets.toolkit.Resources

public class Resources extends Object
Access to the localizable resources used by a doclet.

The resources are split across two resource bundles: one that contains format-neutral strings common to all supported formats, and one that contains strings specific to the selected doclet, such as the standard HTML doclet.

  • Felddetails

  • Konstruktordetails

    • Resources

      public Resources(Locale locale, String commonBundleName, String docletBundleName)
      Creates a Resources object to provide access the resource bundles used by a doclet.
      Parameter:
      locale - the locale to be used when accessing the resource bundles.
      commonBundleName - the name of the bundle containing the strings common to all output formats
      docletBundleName - the name of the bundle containing the strings specific to a particular format
  • Methodendetails

    • setKeyMapper

      public void setKeyMapper(Function<String,String> mapper)
    • getText

      Returns the string for the given key from one of the doclet’s resource bundles.

      If the current mapper is not null, it will be applied to the key before looking up the resulting key in the resource bundle(s).

      The more specific bundle is checked first; if it is not there, the common bundle is then checked.

      Parameter:
      key - the key for the desired string
      Gibt zurück:
      the string for the given key
      Löst aus:
      MissingResourceException - if the key is not found in either bundle.
    • getText

      public String getText(String key, Object... args) throws MissingResourceException
      Returns the string for the given key (after applying the current mapper if it is not null) from one of the doclet’s resource bundles, substituting additional arguments into into the resulting string with MessageFormat.format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition).

      The more specific bundle is checked first; if it is not there, the common bundle is then checked.

      Parameter:
      key - the key for the desired string
      args - values to be substituted into the resulting string
      Gibt zurück:
      the string for the given key
      Löst aus:
      MissingResourceException - if the key is not found in either bundle.