javax.portlet.faces.preference
Interface Preference


public interface Preference

The Preference interface allows one to access each value from PortletPreferences as a discrete object. This allows one to more easily access a preference via EL. Operations made on a Preference object are immediately reflected in the underlying PortletPreferences. Changes are not committed until PortletPreferences.store() is called.

Author:
Michael Freedman, Neil Griffin

Method Summary
 String getName()
          Returns the name of this preference.
 String getValue()
          Returns the first String value associated with this preference.
 List<String> getValues()
          Returns a List of values associated with this preference.
 boolean isReadOnly()
          Returns true, if the value of this preference cannot be modified by the user.
 void reset()
          Resets or removes the value(s) of this preference.
 void setName(String name)
          Sets the name of this preference.
 void setValue(String value)
          Associates the specified String value with this preference.
 void setValues(String[] values)
          Associates the specified String array value with this preference.
 

Method Detail

getName

String getName()
Returns the name of this preference.

Returns:
the name of this preference.

getValue

String getValue()
Returns the first String value associated with this preference. If there is one or more values associated with this preference it returns the first associated value. If there are no values associated with this preference, or the backing preference database is unavailable, it returns nulll.

Returns:
the first value associated with this preference, or null if there isn't an associated value or the backing store is inaccessible.
See Also:
getValues()

getValues

List<String> getValues()
Returns a List of values associated with this preference.

Returns null if there aren't any values, or if the backing store is inaccessible.

If the implementation supports stored defaults and such a default exists and is accessible, they are returned in a situation where null otherwise would have been returned.

Returns:
the list of values associated with this preference, or null if the associated value does not exist.
See Also:
getValue()

isReadOnly

boolean isReadOnly()

Returns true, if the value of this preference cannot be modified by the user.

Modifiable preferences can be changed by the portlet in any standard portlet mode (EDIT, HELP, VIEW). Per default every preference is modifiable.

Read-only preferences cannot be changed by the portlet in any standard portlet mode, but inside of custom modes it may be allowed changing them. Preferences are read-only, if they are defined in the deployment descriptor with read-only set to true, or if the portlet container restricts write access.

Returns:
true if the value of this preference cannot be modified by the user. Otherwise false.

reset

void reset()
           throws javax.portlet.ReadOnlyException

Resets or removes the value(s) of this preference.

If this implementation supports stored defaults, and there is such a default for the specified preference, the preference will be reset to the stored default.

If there is no default available the preference will be removed from the underlying system.

Throws:
javax.portlet.ReadOnlyException - - if this preference cannot be modified for this request.

setName

void setName(String name)
Sets the name of this preference.

Parameters:
name - the new name for this preference.

setValue

void setValue(String value)
              throws javax.portlet.ReadOnlyException

Associates the specified String value with this preference.

null values for the value parameter are permitted.

Parameters:
value - The value that is to be associated with the preference name.
Throws:
javax.portlet.ReadOnlyException - - if this preference cannot be modified for this request.
See Also:
setValues(String[])

setValues

void setValues(String[] values)
               throws javax.portlet.ReadOnlyException

Associates the specified String array value with this preference.

null values in the values parameter are permitted.

Parameters:
values - The values that are to be associated with the preference name.
Throws:
javax.portlet.ReadOnlyException - - if this preference cannot be modified for this request.
See Also:
setValue(String)


Copyright © 2017 Liferay, Inc. All Rights Reserved.