Class Errors

All Implemented Interfaces:
Localized

public final class Errors extends IndexedResourceBundle
Locale-dependent resources for error messages.

Argument order convention

This resource bundle applies the same convention than JUnit: for every format(…) method, the first arguments provide information about the context in which the error occurred (e.g. the name of a method argument or the range of valid values), while the erroneous values that caused the error are last. Note that being the last programmatic parameter does not means that the value will appears last in the formatted text, since every localized message can reorder the parameters as they want.
Since:
0.3
Version:
1.1
  • Constructor Details

    • Errors

      Errors(URL resources)
      Constructs a new resource bundle loading data from the given UTF file.
      Parameters:
      resources - the path of the binary file containing resources, or null if there are no resources. The resources may be a file or an entry in a JAR file.
  • Method Details

    • getKeyConstants

      protected KeyConstants getKeyConstants()
      Returns the handle for the Keys constants.
      Overrides:
      getKeyConstants in class IndexedResourceBundle
      Returns:
      a handler for the constants declared in the inner Keys class.
    • getResources

      public static Errors getResources(Locale locale) throws MissingResourceException
      Returns resources in the given locale.
      Parameters:
      locale - the locale, or null for the default locale.
      Returns:
      resources in the given locale.
      Throws:
      MissingResourceException - if resources cannot be found.
    • getResources

      public static Errors getResources(Map<?,?> properties) throws MissingResourceException
      Returns resources in the locale specified in the given property map. This convenience method looks for the IndexedResourceBundle.LOCALE_KEY entry. If the given map is null, or contains no entry for the locale key, or the value is not an instance of Locale, then this method fallback on the default locale.
      Parameters:
      properties - the map of properties, or null if none.
      Returns:
      resources in the given locale.
      Throws:
      MissingResourceException - if resources cannot be found.
      Since:
      0.4
    • format

      public static String format(short key) throws MissingResourceException
      Gets a string for the given key from this resource bundle or one of its parents.
      Parameters:
      key - the key for the desired string.
      Returns:
      the string for the given key.
      Throws:
      MissingResourceException - if no object for the given key can be found.
    • format

      public static String format(short key, Object arg0) throws MissingResourceException
      Gets a string for the given key and replaces all occurrence of "{0}" with value of arg0.
      Parameters:
      key - the key for the desired string.
      arg0 - value to substitute to "{0}".
      Returns:
      the formatted string for the given key.
      Throws:
      MissingResourceException - if no object for the given key can be found.
    • format

      public static String format(short key, Object arg0, Object arg1) throws MissingResourceException
      Gets a string for the given key and replaces all occurrence of "{0}", "{1}", with values of arg0, arg1.
      Parameters:
      key - the key for the desired string.
      arg0 - value to substitute to "{0}".
      arg1 - value to substitute to "{1}".
      Returns:
      the formatted string for the given key.
      Throws:
      MissingResourceException - if no object for the given key can be found.
    • format

      public static String format(short key, Object arg0, Object arg1, Object arg2) throws MissingResourceException
      Gets a string for the given key and replaces all occurrence of "{0}", "{1}", with values of arg0, arg1, etc.
      Parameters:
      key - the key for the desired string.
      arg0 - value to substitute to "{0}".
      arg1 - value to substitute to "{1}".
      arg2 - value to substitute to "{2}".
      Returns:
      the formatted string for the given key.
      Throws:
      MissingResourceException - if no object for the given key can be found.
    • format

      public static String format(short key, Object arg0, Object arg1, Object arg2, Object arg3) throws MissingResourceException
      Gets a string for the given key and replaces all occurrence of "{0}", "{1}", with values of arg0, arg1, etc.
      Parameters:
      key - the key for the desired string.
      arg0 - value to substitute to "{0}".
      arg1 - value to substitute to "{1}".
      arg2 - value to substitute to "{2}".
      arg3 - value to substitute to "{3}".
      Returns:
      the formatted string for the given key.
      Throws:
      MissingResourceException - if no object for the given key can be found.
    • formatInternational

      public static org.opengis.util.InternationalString formatInternational(short key)
      Gets an international string for the given key. This method does not check for the key validity. If the key is invalid, then a MissingResourceException may be thrown when a InternationalString.toString(Locale) method is invoked.
      Parameters:
      key - the key for the desired string.
      Returns:
      an international string for the given key.
    • formatInternational

      public static org.opengis.util.InternationalString formatInternational(short key, Object arg)
      Gets an international string for the given key. This method does not check for the key validity. If the key is invalid, then a MissingResourceException may be thrown when a InternationalString.toString(Locale) method is invoked.
      API note: This method is redundant with the one expecting Object..., but avoid the creation of a temporary array. There is no risk of confusion since the two methods delegate their work to the same format method anyway.
      Parameters:
      key - the key for the desired string.
      arg - values to substitute to "{0}".
      Returns:
      an international string for the given key.
    • formatInternational

      public static org.opengis.util.InternationalString formatInternational(short key, Object... args)
      Gets an international string for the given key. This method does not check for the key validity. If the key is invalid, then a MissingResourceException may be thrown when a InternationalString.toString(Locale) method is invoked.
      Parameters:
      key - the key for the desired string.
      args - values to substitute to "{0}", "{1}", etc.
      Returns:
      an international string for the given key.