Interface StringResourceAccessor

  • All Known Subinterfaces:
    StringAndIconResourceAccessor
    All Known Implementing Classes:
    ResourceBundleAccessor

    public interface StringResourceAccessor
    Describes an object that can access a String resource via a key.

    This interface is used by the JGoodies Forms and the JGoodies Standard Dialog Library (JSDL) to access Strings from ResourceBundles and ResourceMaps (a class from JGoodies Application). The latter implements this interface directly. Since ResourceBundle does not implement this interface, a wrapper can be used that implements this interface and just delegates to the ResourceBundle to look up the String for a given resource key.

    Note: This class is not part of the public JGoodies Common API. It's intended for implementation purposes only. The class's API may change at any time.

    Since:
    1.8
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getString​(java.lang.String key, java.lang.Object... args)
      Looks up and returns a String associated with the given resource key.
    • Method Detail

      • getString

        java.lang.String getString​(java.lang.String key,
                                   java.lang.Object... args)
        Looks up and returns a String associated with the given resource key. If no arguments are provided, the plain String is returned. Otherwise the string will be formatted using String.format with the given arguments.
        Parameters:
        key - the key in the resource bundle
        args - optional format arguments forwarded to String#format
        Returns:
        the String value found for the given resource key, formatted with the optional arguments - if any
        See Also:
        String.format(String, Object...)