Holger's Java API

## com.antelmann.util
Interface Localizable

All Known Subinterfaces:
  DocumentEntry, Unit

All Known Implementing Classes:
  AreaUnit, BaseDocument, BaseUnit, CalendarTableModel, Country, CurrencyUnit, DBDocument, DefaultUnit, GlobalAddress, Holiday, ImageURLEntry, ImmutableGlobalAddress, ImmutableSnailMailAddress, LengthUnit, Localizable.Adapter, SIBaseUnit, SnailMailAddress, Temperature, TimeInterval, Weight

    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.

Since:
  29.07.2010, 20:59:13
Author:
  Holger Antelmann
See Also:
  `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

### setLocale

    void setLocale(Locale locale,
                   Object context)
                   throws ResourceNotFoundException,
                          IllegalArgumentException

  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.

  Parameters:
    `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.
  Throws:
    `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.
  See Also:
    `getLocale()`

### getLocale

    Locale getLocale()

  allows access to the Locale that this instance currently uses to localize its messages,

  Returns:
    the current Locale that this instance uses to determine return values for its methods; if null is returned, this instance is expected to use the default Locale of the system.
  See Also:
    `setLocale(Locale, Object)`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads