com.ibm.portal.portletmodel
Interface PortletPreferences<E extends java.util.Map.Entry<java.lang.String,java.lang.String>>

All Superinterfaces:
ListModel<E>, MetaData<java.lang.String,E>
All Known Subinterfaces:
ModifiablePortletPreferences<E>

public interface PortletPreferences<E extends java.util.Map.Entry<java.lang.String,java.lang.String>>
extends MetaData<java.lang.String,E>

An interface describing portlet preferences. Portlet preferences are not the same as metadata in general, but they may alternatively be accessed using the same interface, therefore this interface extends MetaData.

In contrast to MetaData, preferences can associate multiple values with a single key; for multi-valued preferences the inherited getValue(java.lang.String) method returns only the first value. Portlet preference values are always strings.

Since:
6.0.1

Method Summary
 java.lang.String getStringValue(java.lang.String aName)
          Returns the first preference value for the given preference key.
 java.lang.String[] getStringValues(java.lang.String aName)
          Returns all preference values for the given preference key.
 java.lang.String getValue(java.lang.String aName)
          Returns the same value as getStringValue(java.lang.String)
 boolean isPreferenceDefined(java.lang.String aName)
          Returns true if the preference with the given name is defined at this level in this set of preferences.
 boolean isReadOnly(java.lang.String aName)
          Return true if the preference is set and marked as read-only in the portlet deployment descriptor.
 java.util.Iterator<E> iterator()
          Returns an iterator holding the key/value pairs as Map.Entry elements.
 
Methods inherited from interface com.ibm.portal.MetaData
getNames
 

Method Detail

getValue

java.lang.String getValue(java.lang.String aName)
Returns the same value as getStringValue(java.lang.String)

Specified by:
getValue in interface MetaData<java.lang.String,E extends java.util.Map.Entry<java.lang.String,java.lang.String>>
Parameters:
aName - the parameter name
Returns:
the value of the meta data entry for the given name, or null if none exists
See Also:
MetaData.getValue(String)

getStringValue

java.lang.String getStringValue(java.lang.String aName)
Returns the first preference value for the given preference key.

Parameters:
aName - the preference key
Returns:
the first preference value or null, if the preference is not set

getStringValues

java.lang.String[] getStringValues(java.lang.String aName)
Returns all preference values for the given preference key. The returned string array must not be modified.

Parameters:
aName - the preference key
Returns:
an array of String representing the preference values or null, if the preference is not set

isReadOnly

boolean isReadOnly(java.lang.String aName)
Return true if the preference is set and marked as read-only in the portlet deployment descriptor.

Read-only preferences can only be modified at the portlet definition layer, therefore the preferences layer of a portlet entity never contains read-only preferences.

Parameters:
aName - the preference key
Returns:
true if the preference is set and marked as read-only

iterator

java.util.Iterator<E> iterator()
                                                                                              throws ModelException
Returns an iterator holding the key/value pairs as Map.Entry elements. To preserve compatibility with the MetaData semantics, the value of a returned entry is the same as the object returned by a getValue(java.lang.String) call. Therefore this method only retrieves the first value for multi-valued preferences.

Specified by:
iterator in interface ListModel<E extends java.util.Map.Entry<java.lang.String,java.lang.String>>
Specified by:
iterator in interface MetaData<java.lang.String,E extends java.util.Map.Entry<java.lang.String,java.lang.String>>
Returns:
an iterator holding key/value pairs of the meta data, never null
Throws:
ModelException - if creation of iterator fails
See Also:
MetaData.iterator()

isPreferenceDefined

boolean isPreferenceDefined(java.lang.String aName)
Returns true if the preference with the given name is defined at this level in this set of preferences. This is equivalent to, but typically more efficient than iterating over the iterator() method and checking for a preference with the given name.

Parameters:
aName - the preference key
Returns:
true if the preference is defined, false otherwise