📄 portletpreferences.html.svn-base
字号:
it returns the first associated value. If there are no preference values associated with the given key, or the backing preference database is unavailable, it returns the given default value. A <code>null</code> value is treated as a non-existent value.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - key for which the associated value is to be returned<DD><CODE>def</CODE> - the value to be returned in the event that there is no value available associated with this <code>key</code>.<DT><B>Returns:</B><DD>the value associated with <code>key</code>, or <code>def</code> if no value is associated with <code>key</code>, or the backing store is inaccessible.<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>key</code> is <code>null</code>. (A <code>null</code> value for <code>def</code> <i>is</i> permitted.)<DT><B>See Also:</B><DD><A HREF="../../javax/portlet/PortletPreferences.html#getValues(java.lang.String, java.lang.String[])"><CODE>getValues(String, String[])</CODE></A></DL></DD></DL><HR><A NAME="getValues(java.lang.String, java.lang.String[])"><!-- --></A><H3>getValues</H3><PRE>java.lang.String[] <B>getValues</B>(java.lang.String key, java.lang.String[] def)</PRE><DL><DD>Returns the String array value associated with the specified key in this preference. <p>Returns the specified default if there is no value associated with the key, or if the backing store is inaccessible. A <code>null</code> value is treated as a non-existent value. <p>If the implementation supports <i>stored defaults</i> and such a default exists and is accessible, it is used in favor of the specified default.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - key for which associated value is to be returned.<DD><CODE>def</CODE> - the value to be returned in the event that this preference node has no value associated with <code>key</code> or the associated value cannot be interpreted as a String array, or the backing store is inaccessible.<DT><B>Returns:</B><DD>the String array value associated with <code>key</code>, or <code>def</code> if the associated value does not exist.<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if <code>key</code> is <code>null</code>. (A <code>null</code> value for <code>def</code> <i>is</i> permitted.)<DT><B>See Also:</B><DD><A HREF="../../javax/portlet/PortletPreferences.html#getValue(java.lang.String, java.lang.String)"><CODE>getValue(String,String)</CODE></A></DL></DD></DL><HR><A NAME="setValue(java.lang.String, java.lang.String)"><!-- --></A><H3>setValue</H3><PRE>void <B>setValue</B>(java.lang.String key, java.lang.String value) throws <A HREF="../../javax/portlet/ReadOnlyException.html" title="class in javax.portlet">ReadOnlyException</A></PRE><DL><DD>Associates the specified String value with the specified key in this preference. <p> The key cannot be <code>null</code>, but <code>null</code> values for the value parameter are allowed. <p> If the same key contained already a <code>String</code> or <code>String[]</code> value it must be replaced by the new value.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - key with which the specified value is to be associated.<DD><CODE>value</CODE> - value to be associated with the specified key.<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/portlet/ReadOnlyException.html" title="class in javax.portlet">ReadOnlyException</A></CODE> - if this preference cannot be modified for this request<DD><CODE>java.lang.IllegalArgumentException</CODE> - if key is <code>null</code>, or <code>key.length()</code> or <code>value.length</code> are to long. The maximum length for key and value are implementation specific.<DT><B>See Also:</B><DD><A HREF="../../javax/portlet/PortletPreferences.html#setValues(java.lang.String, java.lang.String[])"><CODE>setValues(String, String[])</CODE></A></DL></DD></DL><HR><A NAME="setValues(java.lang.String, java.lang.String[])"><!-- --></A><H3>setValues</H3><PRE>void <B>setValues</B>(java.lang.String key, java.lang.String[] values) throws <A HREF="../../javax/portlet/ReadOnlyException.html" title="class in javax.portlet">ReadOnlyException</A></PRE><DL><DD>Associates the specified String array value with the specified key in this preference. <p> The key cannot be <code>null</code>, but <code>null</code> values in the values parameter are allowed. <p> If the same key contained already a <code>String</code> or <code>String[]</code> value it must be replaced by the new value.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - key with which the value is to be associated<DD><CODE>values</CODE> - values to be associated with key<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if key is <code>null</code>, or <code>key.length()</code> is to long or <code>value.size</code> is to large. The maximum length for key and maximum size for value are implementation specific.<DD><CODE><A HREF="../../javax/portlet/ReadOnlyException.html" title="class in javax.portlet">ReadOnlyException</A></CODE> - if this preference cannot be modified for this request<DT><B>See Also:</B><DD><A HREF="../../javax/portlet/PortletPreferences.html#setValue(java.lang.String, java.lang.String)"><CODE>setValue(String,String)</CODE></A></DL></DD></DL><HR><A NAME="getNames()"><!-- --></A><H3>getNames</H3><PRE>java.util.Enumeration<java.lang.String> <B>getNames</B>()</PRE><DL><DD>Returns all of the keys that have an associated value, or an empty <code>Enumeration</code> if no keys are available.<P><DD><DL><DT><B>Returns:</B><DD>an Enumeration of the keys that have an associated value, or an empty <code>Enumeration</code> if no keys are available.</DL></DD></DL><HR><A NAME="getMap()"><!-- --></A><H3>getMap</H3><PRE>java.util.Map<java.lang.String,java.lang.String[]> <B>getMap</B>()</PRE><DL><DD>Returns a <code>Map</code> of the preferences. <p> The values in the returned <code>Map</code> are from type String array (<code>String[]</code>). <p> If no preferences exist this method returns an empty <code>Map</code>.<P><DD><DL><DT><B>Returns:</B><DD>an immutable <code>Map</code> containing preference names as keys and preference values as map values, or an empty <code>Map</code> if no preference exist. The keys in the preference map are of type String. The values in the preference map are of type String array (<code>String[]</code>).</DL></DD></DL><HR><A NAME="reset(java.lang.String)"><!-- --></A><H3>reset</H3><PRE>void <B>reset</B>(java.lang.String key) throws <A HREF="../../javax/portlet/ReadOnlyException.html" title="class in javax.portlet">ReadOnlyException</A></PRE><DL><DD>Resets or removes the value associated with the specified key. <p> If this implementation supports stored defaults, and there is such a default for the specified preference, the given key will be reset to the stored default. <p> If there is no default available the key will be removed.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - to reset<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - if key is <code>null</code>.<DD><CODE><A HREF="../../javax/portlet/ReadOnlyException.html" title="class in javax.portlet">ReadOnlyException</A></CODE> - if this preference cannot be modified for this request</DL></DD></DL><HR><A NAME="store()"><!-- --></A><H3>store</H3><PRE>void <B>store</B>() throws java.io.IOException, <A HREF="../../javax/portlet/ValidatorException.html" title="class in javax.portlet">ValidatorException</A></PRE><DL><DD>Commits all changes made to the preferences via the <code>set</code> methods in the persistent store. <P> If this call returns successful, all changes are made persistent. If this call fails, no changes are made in the persistent store. This call is an atomic operation regardless of how many preference attributes have been modified. <P> All changes made to preferences not followed by a call to the <code>store</code> method are discarded when the portlet finishes the <code>processAction</code> method. <P> If a validator is defined for this preferences in the deployment descriptor, this validator is called before the actual store is performed to check whether the given preferences are valid. If this check fails a <code>ValidatorException</code> is thrown.<P><DD><DL><DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if changes cannot be written into the backend store<DD><CODE><A HREF="../../javax/portlet/ValidatorException.html" title="class in javax.portlet">ValidatorException</A></CODE> - if the validation performed by the associated validator fails<DD><CODE>java.lang.IllegalStateException</CODE> - if this method is called inside a render call<DT><B>See Also:</B><DD><A HREF="../../javax/portlet/PreferencesValidator.html" title="interface in javax.portlet"><CODE>PreferencesValidator</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/PortletPreferences.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/portlet/PortletModeException.html" title="class in javax.portlet"><B>PREV CLASS</B></A> <A HREF="../../javax/portlet/PortletRequest.html" title="interface in javax.portlet"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?javax/portlet/PortletPreferences.html" target="_top"><B>FRAMES</B></A> <A HREF="PortletPreferences.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -