com.sun.portal.providers.context
Class LocalePropertiesFilter

java.lang.Object
  extended bycom.sun.portal.providers.context.PropertiesFilter
      extended bycom.sun.portal.providers.context.LocalePropertiesFilter

public class LocalePropertiesFilter
extends PropertiesFilter

This class implements the "locale" filter.


Constructor Summary
LocalePropertiesFilter()
          Constructor.
 
Method Summary
 String getCondition()
          Return "locale"
static Locale getLocale(List pflist)
          A convenient method for converting LocalePropertiesFilters into a locale object.
static List getLocalePropertiesFilters(Locale locale, boolean required)
          A convenient method for converting Locale into a list of LocalePropertiesFilters.
 boolean match(String condition, String value)
          Does the given condition and value match this locale filter? This match method is based on a case-sensitive string comparison.
 
Methods inherited from class com.sun.portal.providers.context.PropertiesFilter
getValue, init, isRequired, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalePropertiesFilter

public LocalePropertiesFilter()
Constructor. Do not call this directly. Instead use PropertiesFilterFactory.get(LOCALE_PROPERTIESFILTER_CLASSNAME, ...).

See Also:
PropertiesFilterFactory.get(String, String, boolean)
Method Detail

getCondition

public String getCondition()
Return "locale"

Specified by:
getCondition in class PropertiesFilter
Returns:
"locale"

match

public boolean match(String condition,
                     String value)
Does the given condition and value match this locale filter? This match method is based on a case-sensitive string comparison. In other words, the condition should be "locale" and value should exactly match the value that was used to instantiate this filter.

Specified by:
match in class PropertiesFilter
Parameters:
condition - filter condition. i.e. "locale"
value - locale suffix (i.e. en, US, etc.)
Returns:
boolean value indicating whether match has succeeded or not.

getLocalePropertiesFilters

public static List getLocalePropertiesFilters(Locale locale,
                                              boolean required)
                                       throws PropertiesFilterException
A convenient method for converting Locale into a list of LocalePropertiesFilters.

Parameters:
locale - Locale object
required - boolean value that determines whether the filters are required or optional
Returns:
List of non-required (optional) LocalePropertiesFilter
Throws:
PropertiesFilterException

getLocale

public static Locale getLocale(List pflist)
                        throws PropertiesFilterException
A convenient method for converting LocalePropertiesFilters into a locale object.

Parameters:
pflist - List of LocalePropertiesFilter objects or other PropertiesFilter that are non-required.
Returns:
Locale object. Returns null if no locale can be instantiated from the given PropertiesFilters.
Throws:
PropertiesFilterException