APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.util

public Class LocalizedMessage

extends Object
Class Inheritance
Imports
java.util.ListResourceBundle

This class produces formatted and localized messages describing security issues. Some messages may be required when the VM is not fully booted. In this case, localization resources and classes used for message formatting may not be available. When the VM is not booted, the message will not be localized, and it will be formatted using simplified message formatting code that is contained in this class.

Field Summary

Modifier and TypeField and Description
private final String
private static final ListResourceBundle

Constructor Summary

AccessConstructor and Description
public
LocalizedMessage(String key)

A LocalizedMessage can be instantiated with a key and formatted with arguments later in the style of MessageFormat.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

A formatted message string
formatLocalized
(Object...
The arguments that should be placed in the message
arguments
)

Return a localized string corresponding to the key stored in this object, formatted with the provided arguments.

public String

Returns:

A formatted message string
formatNonlocalized
(Object...
The arguments that should be placed in the message
arguments
)

Return a non-localized string corresponding to the key stored in this object, formatted with the provided arguments.

public static String

Returns:

A formatted message string
getLocalized
(String
The key of the desired string in the security resource bundle
key
,
Object...
The arguments that should be placed in the message
arguments
)

Return a localized string corresponding to the provided key, and formatted with the provided arguments.

public static String

Returns:

A formatted message string
getNonlocalized
(String
The key of the desired string in resources
key
,
Object...
The arguments that should be placed in the message
arguments
)

Return a non-localized string corresponding to the provided key, and formatted with the provided arguments.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyback to summary
private final String key
RESOURCESback to summary
private static final ListResourceBundle RESOURCES

Constructor Detail

LocalizedMessageback to summary
public LocalizedMessage(String key)

A LocalizedMessage can be instantiated with a key and formatted with arguments later in the style of MessageFormat. This organization allows the actual formatting to be avoided unless the resulting string is needed.

Method Detail

formatLocalizedback to summary
public String formatLocalized(Object... arguments)

Return a localized string corresponding to the key stored in this object, formatted with the provided arguments. This method should only be called when the VM is booted and all resources needed to obtain and format the localized message are loaded (or can be loaded).

Parameters
arguments:Object[]

The arguments that should be placed in the message

Returns:String

A formatted message string

formatNonlocalizedback to summary
public String formatNonlocalized(Object... arguments)

Return a non-localized string corresponding to the key stored in this object, formatted with the provided arguments. All strings are obtained from sun.security.util.resources, and the formatting only supports simple positional argument replacement (e.g. {1}).

Parameters
arguments:Object[]

The arguments that should be placed in the message

Returns:String

A formatted message string

getLocalizedback to summary
public static String getLocalized(String key, Object... arguments)

Return a localized string corresponding to the provided key, and formatted with the provided arguments. This method should only be called when the VM is booted and all resources needed to obtain and format the localized message are loaded (or can be loaded).

Parameters
key:String

The key of the desired string in the security resource bundle

arguments:Object[]

The arguments that should be placed in the message

Returns:String

A formatted message string

getNonlocalizedback to summary
public static String getNonlocalized(String key, Object... arguments)

Return a non-localized string corresponding to the provided key, and formatted with the provided arguments. All strings are obtained from sun.security.util.resources, and the formatting only supports simple positional argument replacement (e.g. {1}).

Parameters
key:String

The key of the desired string in resources

arguments:Object[]

The arguments that should be placed in the message

Returns:String

A formatted message string