org.jvnet.localizer
Class LocaleProvider

java.lang.Object
  extended by org.jvnet.localizer.LocaleProvider

public abstract class LocaleProvider
extends java.lang.Object

Determines the locale, normally from the context.

For example, in webapps, you might use the current request's Accept-Language header, or maybe it's just an invocation to Locale.getDefault().

A single instance of LocaleProvider is maintained in this class for the use by ResourceBundleHolder.

Author:
Kohsuke Kawaguchi

Field Summary
static LocaleProvider DEFAULT
          LocaleProvider that uses Locale.getDefault().
 
Constructor Summary
LocaleProvider()
           
 
Method Summary
abstract  java.util.Locale get()
          Determines the locale to be used.
static java.util.Locale getLocale()
          Short for getProvider().get()
static LocaleProvider getProvider()
          Gets the currently installed system-wide LocaleProvider.
static void setProvider(LocaleProvider p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final LocaleProvider DEFAULT
LocaleProvider that uses Locale.getDefault().

Constructor Detail

LocaleProvider

public LocaleProvider()
Method Detail

get

public abstract java.util.Locale get()
Determines the locale to be used.

Returns:
must not be null.

setProvider

public static void setProvider(LocaleProvider p)

getProvider

public static LocaleProvider getProvider()
Gets the currently installed system-wide LocaleProvider.

Returns:
always non-null.

getLocale

public static java.util.Locale getLocale()
Short for getProvider().get()



Copyright © 2011. All Rights Reserved.