org.rhq.enterprise.server.auth.prefs
Class SubjectPreferencesBase

java.lang.Object
  extended by org.rhq.enterprise.server.auth.prefs.SubjectPreferencesBase
Direct Known Subclasses:
MeasurementPreferences, SubjectPreferences

public abstract class SubjectPreferencesBase
extends Object


Field Summary
protected  org.apache.commons.logging.Log log
           
protected static String PREF_ITEM_DELIM
           
protected static String PREF_ITEM_DELIM_REGEX
           
protected static String PREF_LIST_DELIM
          delimiter for preferences that are multi-valued and stringified
 
Constructor Summary
SubjectPreferencesBase(org.rhq.core.domain.auth.Subject subject)
           
 
Method Summary
protected  boolean getBooleanPref(String key)
          Get the value of a preference as a boolean.
protected  boolean getBooleanPref(String key, boolean ifNull)
          Get the value of a preference as a boolean.
protected  int getIntPref(String key)
          Get the value of a preference as an int.
protected  int getIntPref(String key, int ifNull)
          Get the value of a preference as an int.
protected  Long getLongPref(String key)
          Get the value of a preference as an long.
protected  String getPreference(String key)
           
<T> T
getPreference(String key, T defaultValue)
           
protected  List<Integer> getPreferenceAsIntegerList(String key, String delimiter)
           
 List<String> getPreferenceAsList(String key)
          Break the named preference into tokens delimited by PREF_LIST_DELIM.
 List<String> getPreferenceAsList(String key, String delimiter)
          Tokenize the named preference into a List of Strings.
protected  void setPreference(String key, List<?> values)
           
protected  void setPreference(String key, List<?> values, String delim)
           
 void setPreference(String key, Object value)
           
protected  void unsetPreference(String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log

PREF_LIST_DELIM

protected static final String PREF_LIST_DELIM
delimiter for preferences that are multi-valued and stringified

See Also:
Constant Field Values

PREF_ITEM_DELIM

protected static final String PREF_ITEM_DELIM
See Also:
Constant Field Values

PREF_ITEM_DELIM_REGEX

protected static final String PREF_ITEM_DELIM_REGEX
See Also:
Constant Field Values
Constructor Detail

SubjectPreferencesBase

public SubjectPreferencesBase(org.rhq.core.domain.auth.Subject subject)
Method Detail

getBooleanPref

protected boolean getBooleanPref(String key)
Get the value of a preference as a boolean.

Parameters:
key - the preference to get
Returns:
the boolean value of 'key', or if key is null, returns the 'ifNull' value.

getBooleanPref

protected boolean getBooleanPref(String key,
                                 boolean ifNull)
Get the value of a preference as a boolean.

Parameters:
key - the preference to get
ifNull - if the pref is undefined, return this value instead
Returns:
the boolean value of 'key', or if key is null, returns the 'ifNull' value.

getIntPref

protected int getIntPref(String key)
Get the value of a preference as an int.

Parameters:
key - the preference to get
Returns:
the int value of 'key'

getIntPref

protected int getIntPref(String key,
                         int ifNull)
Get the value of a preference as an int.

Parameters:
key - the preference to get
ifNull - if the pref is null, return this value instead
Returns:
the int value of 'key', or if key is null, returns the 'ifNull' value.

getLongPref

protected Long getLongPref(String key)
Get the value of a preference as an long.

Parameters:
key - the preference to get
Returns:
the long value of 'key'

getPreference

protected String getPreference(String key)
                        throws IllegalArgumentException
Throws:
IllegalArgumentException

getPreference

public <T> T getPreference(String key,
                           T defaultValue)

getPreferenceAsList

public List<String> getPreferenceAsList(String key)
Break the named preference into tokens delimited by PREF_LIST_DELIM.

Parameters:
key - the name of the preference
Returns:
List of String tokens

getPreferenceAsList

public List<String> getPreferenceAsList(String key,
                                        String delimiter)
Tokenize the named preference into a List of Strings. If no such preference exists, or the preference is null, an empty List will be returned.

Parameters:
delimiter - the delimiter to break it up by
key - the name of the preference
Returns:
List of String tokens

getPreferenceAsIntegerList

protected List<Integer> getPreferenceAsIntegerList(String key,
                                                   String delimiter)

setPreference

protected void setPreference(String key,
                             List<?> values)
                      throws IllegalArgumentException
Throws:
IllegalArgumentException

setPreference

protected void setPreference(String key,
                             List<?> values,
                             String delim)
                      throws IllegalArgumentException
Throws:
IllegalArgumentException

setPreference

public void setPreference(String key,
                          Object value)
                   throws IllegalArgumentException
Throws:
IllegalArgumentException

unsetPreference

protected void unsetPreference(String key)


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.