Class WrapperResources


  • public final class WrapperResources
    extends java.lang.Object
    A resource bundle which is used to help localize applications to the default locale of the JVM. Resources are stored in MO files using the standard UNIX gettext resources. For example,

    WrapperResources res = WrapperManager.loadWrapperResources( "myapp", "../lang/" ); To use the WrapperResources, make a call to any of the getString() methods. If the resource files are not found, or the specific key is not found then the key is returned unmodified. All resource keys passed to getString() will be processed using the java.util.MessageFormat class. As such, single quotes must be escaped. This class can optionally validate all such keys and logs warnings about keys which fail these checks. It is possible to enable this validation with the following property. (Defaults to FALSE) -Dorg.tanukisoftware.wrapper.WrapperResources.validateResourceKeys=TRUE

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected WrapperResources()
      WrapperResources instances are created using the WrapperManager.loadWrapperResources method.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void finalize()  
      java.lang.String getString​(java.lang.String key)
      Request a localized version of the specified key.
      java.lang.String getString​(java.lang.String key, java.lang.Object arg0)
      Request a localized version of the specified key.
      java.lang.String getString​(java.lang.String key, java.lang.Object[] arguments)
      Request a localized version of the specified key.
      java.lang.String getString​(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1)
      Request a localized version of the specified key.
      java.lang.String getString​(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
      Request a localized version of the specified key.
      java.lang.String getString​(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
      Request a localized version of the specified key.
      java.lang.String getString​(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
      Request a localized version of the specified key.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WrapperResources

        protected WrapperResources()
        WrapperResources instances are created using the WrapperManager.loadWrapperResources method.
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • getString

        public java.lang.String getString​(java.lang.String key)
        Request a localized version of the specified key.
        Parameters:
        key - Resource to be localized.
        Returns:
        The localized version of the key.
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.Object[] arguments)
        Request a localized version of the specified key.

        Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

        Parameters:
        key - Resource to be localized.
        arguments - An array of argumens to be replaced in the resource.
        Returns:
        The localized version of the key.
        See Also:
        MessageFormat
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.Object arg0)
        Request a localized version of the specified key.

        Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

        Parameters:
        key - Resource to be localized.
        arg0 - An argument to be replaced in the resource.
        Returns:
        The localized version of the key.
        See Also:
        MessageFormat
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.Object arg0,
                                          java.lang.Object arg1)
        Request a localized version of the specified key.

        Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

        Parameters:
        key - Resource to be localized.
        arg0 - An argument to be replaced in the resource.
        arg1 - An argument to be replaced in the resource.
        Returns:
        The localized version of the key.
        See Also:
        MessageFormat
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.Object arg0,
                                          java.lang.Object arg1,
                                          java.lang.Object arg2)
        Request a localized version of the specified key.

        Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

        Parameters:
        key - Resource to be localized.
        arg0 - An argument to be replaced in the resource.
        arg1 - An argument to be replaced in the resource.
        arg2 - An argument to be replaced in the resource.
        Returns:
        The localized version of the key.
        See Also:
        MessageFormat
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.Object arg0,
                                          java.lang.Object arg1,
                                          java.lang.Object arg2,
                                          java.lang.Object arg3)
        Request a localized version of the specified key.

        Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

        Parameters:
        key - Resource to be localized.
        arg0 - An argument to be replaced in the resource.
        arg1 - An argument to be replaced in the resource.
        arg2 - An argument to be replaced in the resource.
        arg3 - An argument to be replaced in the resource.
        Returns:
        The localized version of the key.
        See Also:
        MessageFormat
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.Object arg0,
                                          java.lang.Object arg1,
                                          java.lang.Object arg2,
                                          java.lang.Object arg3,
                                          java.lang.Object arg4)
        Request a localized version of the specified key.

        Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

        Parameters:
        key - Resource to be localized.
        arg0 - An argument to be replaced in the resource.
        arg1 - An argument to be replaced in the resource.
        arg2 - An argument to be replaced in the resource.
        arg3 - An argument to be replaced in the resource.
        arg4 - An argument to be replaced in the resource.
        Returns:
        The localized version of the key.
        See Also:
        MessageFormat