|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Localizable
instances of Localizable are objects that support localized return values for their methods based on a Locale that can be set on the instance prior to calling a method. To ensure that - after setting a specific Locale - the subsequent method calls to indeed correspond with the Locale set, the caller must synchronize on the instance. Note that the Locale is considered a transient property! If a certain method doesn't provide a specific localization for a given Locale, it returns the value for the best available fit. Implementing classes should ensure proper synchronization to guarantee that localized method calls remain consistent as long as the caller holds the monitor lock on the object. The localizable aspect of an object may also apply to setter methods, so that if a setter method (w/o a locale as a parameter) is called, it changes the representation of the currently specified locale for the instance.
Localized| Nested Class Summary | |
|---|---|
static class |
Localizable.Adapter
|
| Method Summary | |
|---|---|
Locale |
getLocale()
allows access to the Locale that this instance currently uses to localize its messages, |
void |
setLocale(Locale locale,
Object context)
sets the Locale for this object so that all subsequent return values of method calls to this instance can be localized accordingly until a different Locale is set. |
| Method Detail |
|---|
void setLocale(Locale locale,
Object context)
throws ResourceNotFoundException,
IllegalArgumentException
locale - the Locale that is to be used to determine return values for all methods
of this instance; if set to null, the default locale is to be used.context - a context that may be required for this instance to load the resources for the given locale;
this context may be null for objects that do not require an external context.
Examples of a context may be a database, a resource file, some map or no context at all.
ResourceNotFoundException - if a required resource to handle the given locale
could not be loaded
IllegalArgumentException - if the given context is considered illegal for this instance.getLocale()Locale getLocale()
setLocale(Locale, Object)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||