org.openbp.common.rc
Class ResourceCollectionUtil

java.lang.Object
  extended by org.openbp.common.rc.ResourceCollectionUtil

public final class ResourceCollectionUtil
extends java.lang.Object

Util class for the resource framework.

Author:
Andreas Putz

Field Summary
static java.lang.String RESOURCE_KEY_DESCRIPTION
          Description resource key
static java.lang.String RESOURCE_KEY_DISPLAYNAME
          Description resource key
 
Method Summary
static java.lang.String formatMsg(ResourceCollection res, java.lang.String key, java.lang.Object arg1)
          Retrieves a message from the given resource and formats it using the given arguments (convenience method).
static java.lang.String formatMsg(ResourceCollection res, java.lang.String key, java.lang.Object[] args)
          Retrieves a message from the given resource and formats it using the given arguments.
static java.lang.String formatMsg(ResourceCollection res, java.lang.String key, java.lang.Object arg1, java.lang.Object arg2)
          Retrieves a message from the given resource and formats it using the given arguments (convenience method).
static java.lang.String formatMsg(ResourceCollection res, java.lang.String key, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Retrieves a message from the given resource and formats it using the given arguments (convenience method).
static java.lang.String formatMsg(java.lang.String containerName, java.lang.String resourceName, java.util.Locale locale, java.lang.String key, java.lang.Object arg1)
          Retrieves a message from the specified resource and formats it using the given arguments using the given locale (convenience method).
static java.lang.String formatMsg(java.lang.String containerName, java.lang.String resourceName, java.util.Locale locale, java.lang.String key, java.lang.Object[] args)
          Retrieves a message from the specified resource and formats it using the given arguments using the given locale.
static java.lang.String formatMsg(java.lang.String containerName, java.lang.String resourceName, java.util.Locale locale, java.lang.String key, java.lang.Object arg1, java.lang.Object arg2)
          Retrieves a message from the specified resource and formats it using the given arguments using the given locale (convenience method).
static java.lang.String formatMsg(java.lang.String containerName, java.lang.String resourceName, java.util.Locale locale, java.lang.String key, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Retrieves a message from the specified resource and formats it using the given arguments using the given locale (convenience method).
static java.lang.String formatMsg(java.lang.String containerName, java.lang.String resourceName, java.lang.String key, java.lang.Object arg1)
          Retrieves a message from the specified resource and formats it using the given arguments using the default locale (convenience method).
static java.lang.String formatMsg(java.lang.String containerName, java.lang.String resourceName, java.lang.String key, java.lang.Object[] args)
          Retrieves a message from the specified resource and formats it using the given arguments using the default locale.
static java.lang.String formatMsg(java.lang.String containerName, java.lang.String resourceName, java.lang.String key, java.lang.Object arg1, java.lang.Object arg2)
          Retrieves a message from the specified resource and formats it using the given arguments using the default locale (convenience method).
static java.lang.String formatMsg(java.lang.String containerName, java.lang.String resourceName, java.lang.String key, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Retrieves a message from the specified resource and formats it using the given arguments using the default locale (convenience method).
static char getOptionalChar(ResourceCollection res, java.lang.String key, char dflt)
          Gets the character value or a default if not found.
static int getOptionalInt(ResourceCollection res, java.lang.String key, int dflt)
          Gets the integer value or a default if not found.
static void loadDescriptionObjectFromResource(DescriptionObject o, ResourceCollection res, java.lang.String prefix)
          Loads the description from the given resource.
static void loadDisplayObjectFromResource(DisplayObject o, ResourceCollection res, java.lang.String prefix)
          Loads the description from the given resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_KEY_DESCRIPTION

public static final java.lang.String RESOURCE_KEY_DESCRIPTION
Description resource key

See Also:
Constant Field Values

RESOURCE_KEY_DISPLAYNAME

public static final java.lang.String RESOURCE_KEY_DISPLAYNAME
Description resource key

See Also:
Constant Field Values
Method Detail

formatMsg

public static java.lang.String formatMsg(ResourceCollection res,
                                         java.lang.String key,
                                         java.lang.Object[] args)
Retrieves a message from the given resource and formats it using the given arguments.

Parameters:
res - Resource that contains the message
key - Resource name of the message
args - Formatting arguments (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(java.lang.String containerName,
                                         java.lang.String resourceName,
                                         java.lang.String key,
                                         java.lang.Object[] args)
Retrieves a message from the specified resource and formats it using the given arguments using the default locale.

Parameters:
containerName - Name of the resource container that contains the message
resourceName - Name of the resource that contains the message
key - Resource name of the message
args - Formatting arguments (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(java.lang.String containerName,
                                         java.lang.String resourceName,
                                         java.util.Locale locale,
                                         java.lang.String key,
                                         java.lang.Object[] args)
Retrieves a message from the specified resource and formats it using the given arguments using the given locale.

Parameters:
containerName - Name of the resource container that contains the message
resourceName - Name of the resource that contains the message
locale - Locale to use; If the locale is null, the default locale will be used
key - Resource name of the message
args - Formatting arguments (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(ResourceCollection res,
                                         java.lang.String key,
                                         java.lang.Object arg1)
Retrieves a message from the given resource and formats it using the given arguments (convenience method).

Parameters:
res - Resource that contains the message
key - Resource name of the message
arg1 - Formatting argument (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(ResourceCollection res,
                                         java.lang.String key,
                                         java.lang.Object arg1,
                                         java.lang.Object arg2)
Retrieves a message from the given resource and formats it using the given arguments (convenience method).

Parameters:
res - Resource that contains the message
key - Resource name of the message
arg1 - Formatting argument (see MsgFormat)
arg2 - Formatting argument (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(ResourceCollection res,
                                         java.lang.String key,
                                         java.lang.Object arg1,
                                         java.lang.Object arg2,
                                         java.lang.Object arg3)
Retrieves a message from the given resource and formats it using the given arguments (convenience method).

Parameters:
res - Resource that contains the message
key - Resource name of the message
arg1 - Formatting argument (see MsgFormat)
arg2 - Formatting argument (see MsgFormat)
arg3 - Formatting argument (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(java.lang.String containerName,
                                         java.lang.String resourceName,
                                         java.lang.String key,
                                         java.lang.Object arg1)
Retrieves a message from the specified resource and formats it using the given arguments using the default locale (convenience method).

Parameters:
containerName - Name of the resource container that contains the message
resourceName - Name of the resource that contains the message
key - Resource name of the message
arg1 - Formatting argument (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(java.lang.String containerName,
                                         java.lang.String resourceName,
                                         java.lang.String key,
                                         java.lang.Object arg1,
                                         java.lang.Object arg2)
Retrieves a message from the specified resource and formats it using the given arguments using the default locale (convenience method).

Parameters:
containerName - Name of the resource container that contains the message
resourceName - Name of the resource that contains the message
key - Resource name of the message
arg1 - Formatting argument (see MsgFormat)
arg2 - Formatting argument (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(java.lang.String containerName,
                                         java.lang.String resourceName,
                                         java.lang.String key,
                                         java.lang.Object arg1,
                                         java.lang.Object arg2,
                                         java.lang.Object arg3)
Retrieves a message from the specified resource and formats it using the given arguments using the default locale (convenience method).

Parameters:
containerName - Name of the resource container that contains the message
resourceName - Name of the resource that contains the message
key - Resource name of the message
arg1 - Formatting argument (see MsgFormat)
arg2 - Formatting argument (see MsgFormat)
arg3 - Formatting argument (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(java.lang.String containerName,
                                         java.lang.String resourceName,
                                         java.util.Locale locale,
                                         java.lang.String key,
                                         java.lang.Object arg1)
Retrieves a message from the specified resource and formats it using the given arguments using the given locale (convenience method).

Parameters:
containerName - Name of the resource container that contains the message
resourceName - Name of the resource that contains the message
locale - Locale to use; If the locale is null, the default locale will be used
key - Resource name of the message
arg1 - Formatting argument (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(java.lang.String containerName,
                                         java.lang.String resourceName,
                                         java.util.Locale locale,
                                         java.lang.String key,
                                         java.lang.Object arg1,
                                         java.lang.Object arg2)
Retrieves a message from the specified resource and formats it using the given arguments using the given locale (convenience method).

Parameters:
containerName - Name of the resource container that contains the message
resourceName - Name of the resource that contains the message
locale - Locale to use; If the locale is null, the default locale will be used
key - Resource name of the message
arg1 - Formatting argument (see MsgFormat)
arg2 - Formatting argument (see MsgFormat)
Returns:
The formatted message

formatMsg

public static java.lang.String formatMsg(java.lang.String containerName,
                                         java.lang.String resourceName,
                                         java.util.Locale locale,
                                         java.lang.String key,
                                         java.lang.Object arg1,
                                         java.lang.Object arg2,
                                         java.lang.Object arg3)
Retrieves a message from the specified resource and formats it using the given arguments using the given locale (convenience method).

Parameters:
containerName - Name of the resource container that contains the message
resourceName - Name of the resource that contains the message
locale - Locale to use; If the locale is null, the default locale will be used
key - Resource name of the message
arg1 - Formatting argument (see MsgFormat)
arg2 - Formatting argument (see MsgFormat)
arg3 - Formatting argument (see MsgFormat)
Returns:
The formatted message

getOptionalInt

public static int getOptionalInt(ResourceCollection res,
                                 java.lang.String key,
                                 int dflt)
Gets the integer value or a default if not found.

Parameters:
res - Resource to get the resource item
key - The resource key
dflt - Default value is resource does not exist
Returns:
The resource value

getOptionalChar

public static char getOptionalChar(ResourceCollection res,
                                   java.lang.String key,
                                   char dflt)
Gets the character value or a default if not found.

Parameters:
res - Resource to get the resource item
key - The resource key
dflt - Default value is resource does not exist
Returns:
The resource value

loadDescriptionObjectFromResource

public static void loadDescriptionObjectFromResource(DescriptionObject o,
                                                     ResourceCollection res,
                                                     java.lang.String prefix)
Loads the description from the given resource.

Parameters:
o - Object that will receive the display name and description from the resource
res - Resource
prefix - Resource prefix or null
If given, the prefix (plus the '.' character) will be prepended to the resouce key.

loadDisplayObjectFromResource

public static void loadDisplayObjectFromResource(DisplayObject o,
                                                 ResourceCollection res,
                                                 java.lang.String prefix)
Loads the description from the given resource.

Parameters:
o - Object that will receive the display name and description from the resource
res - Resource
prefix - Resource prefix or null
If given, the prefix (plus the '.' character) will be prepended to the resouce key.


Copyright © 2011. All Rights Reserved.