enumconverter.html

来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 588 行 · 第 1/3 页

HTML
588
字号
            <A HREF="../../../javax/faces/component/UIComponent.html" title="class in javax.faces.component">UIComponent</A>&nbsp;component,            <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert the enum constant given by the <code>value</code> argument into a String.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/faces/convert/EnumConverter.html#isTransient()">isTransient</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If true, the Object implementing this interface must not participate in state saving or restoring.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/faces/convert/EnumConverter.html#restoreState(javax.faces.context.FacesContext, java.lang.Object)">restoreState</A></B>(<A HREF="../../../javax/faces/context/FacesContext.html" title="class in javax.faces.context">FacesContext</A>&nbsp;facesContext,             <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;object)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Perform any processing required to restore the state from the entries in the state Object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/faces/convert/EnumConverter.html#saveState(javax.faces.context.FacesContext)">saveState</A></B>(<A HREF="../../../javax/faces/context/FacesContext.html" title="class in javax.faces.context">FacesContext</A>&nbsp;facesContext)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Gets the state of the instance as a <code>Serializable</code> Object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/faces/convert/EnumConverter.html#setTransient(boolean)">setTransient</A></B>(boolean&nbsp;b)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD></TR></TABLE>&nbsp;<P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Field Detail</B></FONT></TH></TR></TABLE><A NAME="CONVERTER_ID"><!-- --></A><H3>CONVERTER_ID</H3><PRE>public static final <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>CONVERTER_ID</B></PRE><DL><DD><p>The standard converter id for this converter.</p><P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.faces.convert.EnumConverter.CONVERTER_ID">Constant Field Values</A></DL></DL><HR><A NAME="ENUM_ID"><!-- --></A><H3>ENUM_ID</H3><PRE>public static final <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>ENUM_ID</B></PRE><DL><DD><p>The message identifier of the <A HREF="../../../javax/faces/application/FacesMessage.html" title="class in javax.faces.application"><CODE>FacesMessage</CODE></A> to be created if the conversion to <code>Enum</code> fails.  The message format string for this message may optionally include the following placeholders: <ul> <li><code>{0}</code> replaced by the unconverted value.</li> <li><code>{1}</code> replaced by one of the enum constants or the empty string if none can be found.</li> <li><code>{2}</code> replaced by a <code>String</code> whose value   is the label of the input component that produced this message.</li> </ul></p><P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.faces.convert.EnumConverter.ENUM_ID">Constant Field Values</A></DL></DL><HR><A NAME="ENUM_NO_CLASS_ID"><!-- --></A><H3>ENUM_NO_CLASS_ID</H3><PRE>public static final <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>ENUM_NO_CLASS_ID</B></PRE><DL><DD><p>The message identifier of the <A HREF="../../../javax/faces/application/FacesMessage.html" title="class in javax.faces.application"><CODE>FacesMessage</CODE></A> to be created if the conversion to <code>Enum</code> fails and no target class has been provided.  The message format string for this message may optionally include the following placeholders: <ul> <li><code>{0}</code> replaced by the unconverted value.</li> <li><code>{1}</code> replaced by a <code>String</code> whose value   is the label of the input component that produced this message.</li> </ul></p><P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.faces.convert.EnumConverter.ENUM_NO_CLASS_ID">Constant Field Values</A></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="EnumConverter()"><!-- --></A><H3>EnumConverter</H3><PRE>public <B>EnumConverter</B>()</PRE><DL></DL><HR><A NAME="EnumConverter(java.lang.Class)"><!-- --></A><H3>EnumConverter</H3><PRE>public <B>EnumConverter</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A>&nbsp;targetClass)</PRE><DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="getAsObject(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.String)"><!-- --></A><H3>getAsObject</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>getAsObject</B>(<A HREF="../../../javax/faces/context/FacesContext.html" title="class in javax.faces.context">FacesContext</A>&nbsp;context,                          <A HREF="../../../javax/faces/component/UIComponent.html" title="class in javax.faces.component">UIComponent</A>&nbsp;component,                          <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;value)</PRE><DL><DD><p>Convert the <code>value</code> argument to one of the enum constants of the class provided in our constructor.  If no  target class argument has been provided to the constructor of  this instance, throw a <code>ConverterException</code>  containing the <A HREF="../../../javax/faces/convert/EnumConverter.html#ENUM_NO_CLASS_ID"><CODE>ENUM_NO_CLASS_ID</CODE></A> message with proper  parameters.  If the <code>value</code> argument is <code>null</code>  or it  has a length of zero, return <code>null</code>.   Otherwise, perform the equivalent of <code>Enum.valueOf</code> using  target class and <code>value</code> and return the <code>Object</code>. If the conversion fails, throw a <code>ConverterException</code>  containing the <A HREF="../../../javax/faces/convert/EnumConverter.html#ENUM_ID"><CODE>ENUM_ID</CODE></A> message with proper parameters.  </p><P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../javax/faces/convert/Converter.html#getAsObject(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.String)">getAsObject</A></CODE> in interface <CODE><A HREF="../../../javax/faces/convert/Converter.html" title="interface in javax.faces.convert">Converter</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>context</CODE> - the <code>FacesContext</code> for this request.<DD><CODE>component</CODE> - the <code>UIComponent</code> to which this value will be applied.<DD><CODE>value</CODE> - the String <code>value</code> to be converted to <code>Object</code>.<DT><B>Returns:</B><DD><code>null</code> if the value to convert is <code>null</code>,   otherwise the result of the conversion<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/faces/convert/ConverterException.html" title="class in javax.faces.convert">ConverterException</A></CODE> - if conversion cannot be successfully  performed<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>context</code> or  <code>component</code> is <code>null</code></DL></DD></DL><HR><A NAME="getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)"><!-- --></A><H3>getAsString</H3>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?