CA Identity Manager
Java SDK r12.5 SP 8

 

com.netegrity.ims.util
Class Localizer

java.lang.Object
  extended by com.netegrity.ims.util.Localizer
All Implemented Interfaces:
java.io.Serializable

public class Localizer
extends java.lang.Object
implements java.io.Serializable

Helper class for retrieving the localized version of a string for a given locale.

The localized string is assigned to a unique property ID in a resource bundle. You pass the property ID to the method that retrieves the localized string.

The string to retrieve can be:

Since:
IdentityMinder 5.6 SP 2
See Also:
Serialized Form

Method Summary
static java.lang.String getBaseName()
          Deprecated. Deprecated in Identity Manager 8.1. Use getBundleName() or getDefaultBundleName().
 java.lang.String getBundleName()
          Retrieves the bundle name for this Localizer instance.
 java.lang.String getConditionallyLocalizedString(java.lang.String property)
          Retrieves the localized string that is mapped to the specified property, provided that the property refers to a label on a task screen.
static java.lang.String getDefaultBundleName()
          Retrieves the default bundle name used for all Localizer instances that do not specify a bundle.
 java.lang.String getFormattedString(java.lang.String property, java.lang.Object[] messageArgs)
          Retrieves the localized string with parameters replaced by specified arguments.
static Localizer getInstance()
          Retrieves an instance of a Localizer object for the current locale and default bundle name.
static Localizer getInstance(java.util.Locale locale)
          Retrieves an instance of a Localizer object for the specified locale and default bundle name.
static Localizer getInstance(java.util.Locale locale, java.lang.String bundleName)
          Retrieves an instance of a Localizer object for the specified Locale and bundle name.
static Localizer getInstance(java.lang.String bundleName)
          Retrieves an instance of a Localizer object for the current locale and the specified bundle name.
 java.util.Locale getLocale()
          Retrieves a Java Locale object.
 java.lang.String getLocalizedString(java.lang.String property)
          Retrieves the localized string that is mapped to the specified property.
static java.util.Locale getThreadLocale()
          Retrieves the locale for the currently executing thread.
static void removeThreadLocale()
          Removes the locale for the currently executing thread.
static void setThreadLocale(java.util.Locale locale)
          Sets the locale for the currently executing thread.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Localizer getInstance()
Retrieves an instance of a Localizer object for the current locale and default bundle name.

Returns:
A Localizer instance for the current locale and default bundle name.
Since:
Identity Manager 8.1

getInstance

public static Localizer getInstance(java.lang.String bundleName)
Retrieves an instance of a Localizer object for the current locale and the specified bundle name.

Parameters:
bundleName - The base bundle name to use for this Localizer instance.
Returns:
A Localizer instance for the current locale and specified bundle name.
Since:
Identity Manager 8.1

getInstance

public static Localizer getInstance(java.util.Locale locale)
Retrieves an instance of a Localizer object for the specified locale and default bundle name.

Parameters:
locale - The Locale to use for this Localizer instance.
Returns:
A Localizer instance for the specified locale and default bundle name.
Since:
IdentityMinder 6.0

getInstance

public static Localizer getInstance(java.util.Locale locale,
                                    java.lang.String bundleName)

Retrieves an instance of a Localizer object for the specified Locale and bundle name.

If no locale is specified, the default locale is used. If no bundle name is specfied, the default bundle is used. The IMSResources bundles are provided with Identity Manager.

Returns:
A Localizer instance for the specified locale and bundle name.
Since:
Identity Manager 8.1

getLocalizedString

public java.lang.String getLocalizedString(java.lang.String property)
                                    throws IMSException

Retrieves the localized string that is mapped to the specified property. The property can refer to any localized element, such as a label on a task screen, a task name, or an exception message.

The mapping takes place in the resource bundle associated with the current locale.

Parameters:
property - The unique ID that is mapped to the string to retrieve.
Returns:
The localized string mapped to property.
Throws:
IMSException

getFormattedString

public java.lang.String getFormattedString(java.lang.String property,
                                           java.lang.Object[] messageArgs)
                                    throws IMSException
Retrieves the localized string with parameters replaced by specified arguments.

Parameters:
property - The unique key that is mapped to the string to retrieve
messageArgs - Arrray of arguments for parametric replacement
Returns:
The localized string with parameters replaced
Throws:
IMSException

getConditionallyLocalizedString

public java.lang.String getConditionallyLocalizedString(java.lang.String property)
                                                 throws IMSException
Retrieves the localized string that is mapped to the specified property, provided that the property refers to a label on a task screen. This method searches for and retrieves only task screen labels that have the prefix imstask.label.

The mapping takes place in the resource bundle associated with the current locale.

Parameters:
property - The unique ID that is mapped to the label to retrieve. The property value must include the prefix imstask.label.
Returns:
The localized task screen label mapped to property. If the specified property can't be found, the method returns the value passed in property.
Throws:
IMSException

getLocale

public java.util.Locale getLocale()
Retrieves a Java Locale object.

Returns:
A Locale object.
Since:
IdentityMinder 6.0

getBundleName

public java.lang.String getBundleName()
Retrieves the bundle name for this Localizer instance.

Returns:
The bundle base name.
Since:
Identity Manager 8.1

getDefaultBundleName

public static java.lang.String getDefaultBundleName()
Retrieves the default bundle name used for all Localizer instances that do not specify a bundle.

Returns:
The default bundle base name.
Since:
Identity Manager 8.1

getBaseName

public static java.lang.String getBaseName()
Deprecated. Deprecated in Identity Manager 8.1. Use getBundleName() or getDefaultBundleName().

This method is deprecated in Identity Manager 8.1 -- bundles are now specified per localizer instance.

The deprecated getBaseName() returns the DEFAULT bundle name of IMSResources (the bundle provided with Identity Manager). Use one of the following methods instead:

setThreadLocale

public static void setThreadLocale(java.util.Locale locale)
Sets the locale for the currently executing thread.

Parameters:
locale - The locale to use for the currently executing thread.
Since:
Identity Manager 8.1

removeThreadLocale

public static void removeThreadLocale()
Removes the locale for the currently executing thread.

Since:
Identity Manager 8.1

getThreadLocale

public static java.util.Locale getThreadLocale()
Retrieves the locale for the currently executing thread. If no locale has been set for the currently executing thread, the system default locale is returned.

Returns:
The locale for the currently executing thread.
Since:
Identity Manager 8.1

CA Identity Manager
Java SDK r12.5 SP 8

06/13/2011

© 2011 CA Technologies, Inc. All rights reserved.