org.jboss.portal.server.plugins.preferences
Class AbstractPreferenceSet

java.lang.Object
  extended by org.jboss.portal.server.plugins.preferences.AbstractPreferenceSet
All Implemented Interfaces:
java.io.Serializable, PreferenceSet

public class AbstractPreferenceSet
extends java.lang.Object
implements PreferenceSet, java.io.Serializable

A simple implementation that store the values in the preference objects which are mutable. The read only set is not supported and throws UnsupportedOperationException.

See Also:
Serialized Form

Field Summary
protected  java.util.Map map
           
 
Constructor Summary
AbstractPreferenceSet()
           
AbstractPreferenceSet(java.util.Map map)
           
 
Method Summary
 Preference getPreference(java.lang.String key)
          Return the preference for the given key.
 Value getValue(java.lang.String key)
          Return the value for the given key or null if it does not exist.
 boolean isReadOnly(java.lang.String key)
          Return the read only value for the given preference.
 java.util.Set keySet()
          Return the key set of all the preferences.
 void setReadOnly(java.lang.String key, boolean readOnly)
          Update the read only value for the given key.
 void setValue(java.lang.String key, Value value)
          Update the value of the given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected java.util.Map map
Constructor Detail

AbstractPreferenceSet

public AbstractPreferenceSet()

AbstractPreferenceSet

public AbstractPreferenceSet(java.util.Map map)
Method Detail

keySet

public java.util.Set keySet()
Description copied from interface: PreferenceSet
Return the key set of all the preferences.

Specified by:
keySet in interface PreferenceSet

getPreference

public Preference getPreference(java.lang.String key)
Description copied from interface: PreferenceSet
Return the preference for the given key. If no preference exists it must return null.

Specified by:
getPreference in interface PreferenceSet
Parameters:
key - the requested key
Returns:
the requested preference or null if it does not exist

getValue

public Value getValue(java.lang.String key)
Description copied from interface: PreferenceSet
Return the value for the given key or null if it does not exist.

Specified by:
getValue in interface PreferenceSet
Parameters:
key - the requested key
Returns:
the requested value or null if it does not exist

setValue

public void setValue(java.lang.String key,
                     Value value)
Description copied from interface: PreferenceSet
Update the value of the given key. If the value object is null it means that the preference must be removed. Implementation can throw an unsupported operation exception when it is abnormal to perform an update.

Specified by:
setValue in interface PreferenceSet
Parameters:
key - the key to update
value - the new value

isReadOnly

public boolean isReadOnly(java.lang.String key)
Description copied from interface: PreferenceSet
Return the read only value for the given preference.

Specified by:
isReadOnly in interface PreferenceSet
Parameters:
key - the requested key
Returns:
the read only value

setReadOnly

public void setReadOnly(java.lang.String key,
                        boolean readOnly)
Description copied from interface: PreferenceSet
Update the read only value for the given key. Implementation can throw an unsupported operation exception when it is abnormal to perform an update.

Specified by:
setReadOnly in interface PreferenceSet
Parameters:
key - the key to update
readOnly - the new read only value