mapelresolver.html

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

HTML
623
字号
<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/el/MapELResolver.html#getValue(javax.el.ELContext, java.lang.Object, java.lang.Object)">getValue</A></B>(<A HREF="../../javax/el/ELContext.html" title="class in javax.el">ELContext</A>&nbsp;context,         <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;base,         <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;property)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If the base object is a map, returns the value associated with the given key, as specified by the <code>property</code> argument.</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/el/MapELResolver.html#isReadOnly(javax.el.ELContext, java.lang.Object, java.lang.Object)">isReadOnly</A></B>(<A HREF="../../javax/el/ELContext.html" title="class in javax.el">ELContext</A>&nbsp;context,           <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;base,           <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;property)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If the base object is a map, returns whether a call to  <A HREF="../../javax/el/MapELResolver.html#setValue(javax.el.ELContext, java.lang.Object, java.lang.Object, java.lang.Object)"><CODE>setValue(javax.el.ELContext, java.lang.Object, java.lang.Object, java.lang.Object)</CODE></A> will always fail.</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/el/MapELResolver.html#setValue(javax.el.ELContext, java.lang.Object, java.lang.Object, java.lang.Object)">setValue</A></B>(<A HREF="../../javax/el/ELContext.html" title="class in javax.el">ELContext</A>&nbsp;context,         <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;base,         <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;property,         <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;val)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If the base object is a map, attempts to set the value associated with the given key, as specified by the <code>property</code> argument.</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><!-- ========= 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="MapELResolver()"><!-- --></A><H3>MapELResolver</H3><PRE>public <B>MapELResolver</B>()</PRE><DL><DD>Creates a new read/write <code>MapELResolver</code>.<P></DL><HR><A NAME="MapELResolver(boolean)"><!-- --></A><H3>MapELResolver</H3><PRE>public <B>MapELResolver</B>(boolean&nbsp;isReadOnly)</PRE><DL><DD>Creates a new <code>MapELResolver</code> whose read-only status is determined by the given parameter.<P><DL><DT><B>Parameters:</B><DD><CODE>isReadOnly</CODE> - <code>true</code> if this resolver cannot modify     maps; <code>false</code> otherwise.</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="getType(javax.el.ELContext, java.lang.Object, java.lang.Object)"><!-- --></A><H3>getType</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A>&lt;?&gt; <B>getType</B>(<A HREF="../../javax/el/ELContext.html" title="class in javax.el">ELContext</A>&nbsp;context,                        <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;base,                        <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;property)</PRE><DL><DD>If the base object is a map, returns the most general acceptable type  for a value in this map. <p>If the base is a <code>Map</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after this method is called, the caller  should ignore the return value.</p> <p>Assuming the base is a <code>Map</code>, this method will always return <code>Object.class</code>. This is because <code>Map</code>s accept any object as the value for a given key.</p><P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../javax/el/ELResolver.html#getType(javax.el.ELContext, java.lang.Object, java.lang.Object)">getType</A></CODE> in class <CODE><A HREF="../../javax/el/ELResolver.html" title="class in javax.el">ELResolver</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>context</CODE> - The context of this evaluation.<DD><CODE>base</CODE> - The map to analyze. Only bases of type <code>Map</code>     are handled by this resolver.<DD><CODE>property</CODE> - The key to return the acceptable type for.     Ignored by this resolver.<DT><B>Returns:</B><DD>If the <code>propertyResolved</code> property of      <code>ELContext</code> was set to <code>true</code>, then     the most general acceptable type; otherwise undefined.<DT><B>Throws:</B><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 context is <code>null</code><DD><CODE><A HREF="../../javax/el/ELException.html" title="class in javax.el">ELException</A></CODE> - if an exception was thrown while performing     the property or variable resolution. The thrown exception     must be included as the cause property of this exception, if     available.</DL></DD></DL><HR><A NAME="getValue(javax.el.ELContext, java.lang.Object, java.lang.Object)"><!-- --></A><H3>getValue</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>getValue</B>(<A HREF="../../javax/el/ELContext.html" title="class in javax.el">ELContext</A>&nbsp;context,                       <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;base,                       <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;property)</PRE><DL><DD>If the base object is a map, returns the value associated with the given key, as specified by the <code>property</code> argument. If the key was not found, <code>null</code> is returned. <p>If the base is a <code>Map</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after this method is called, the caller  should ignore the return value.</p> <p>Just as in <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/util/Map.html#get(java.lang.Object)" title="class or interface in java.util"><CODE>Map.get(java.lang.Object)</CODE></A>, just because <code>null</code> is returned doesn't mean there is no mapping for the key; it's also possible that the <code>Map</code> explicitly maps the key to <code>null</code>.</p><P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../javax/el/ELResolver.html#getValue(javax.el.ELContext, java.lang.Object, java.lang.Object)">getValue</A></CODE> in class <CODE><A HREF="../../javax/el/ELResolver.html" title="class in javax.el">ELResolver</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>context</CODE> - The context of this evaluation.<DD><CODE>base</CODE> - The map to be analyzed. Only bases of type <code>Map</code>     are handled by this resolver.<DD><CODE>property</CODE> - The key whose associated value is to be returned.<DT><B>Returns:</B><DD>If the <code>propertyResolved</code> property of      <code>ELContext</code> was set to <code>true</code>, then     the value associated with the given key or <code>null</code>     if the key was not found. Otherwise, undefined.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/ClassCastException.html" title="class or interface in java.lang">ClassCastException</A></CODE> - if the key is of an inappropriate type      for this map (optionally thrown by the underlying <code>Map</code>).<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 context is <code>null</code>, or if      the key is null and this map does not permit null keys (the     latter is optionally thrown by the underlying <code>Map</code>).<DD><CODE><A HREF="../../javax/el/ELException.html" title="class in javax.el">ELException</A></CODE> - if an exception was thrown while performing     the property or variable resolution. The thrown exception     must be included as the cause property of this exception, if     available.</DL></DD></DL><HR><A NAME="setValue(javax.el.ELContext, java.lang.Object, java.lang.Object, java.lang.Object)"><!-- --></A><H3>setValue</H3><PRE>public void <B>setValue</B>(<A HREF="../../javax/el/ELContext.html" title="class in javax.el">ELContext</A>&nbsp;context,                     <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;base,                     <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;property,                     <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;val)</PRE><DL><DD>If the base object is a map, attempts to set the value associated with the given key, as specified by the <code>property</code> argument. <p>If the base is a <code>Map</code>, the <code>propertyResolved</code> property of the <code>ELContext</code> object must be set to <code>true</code> by this resolver, before returning. If this property is not <code>true</code> after this method is called, the caller  can safely assume no value was set.</p> <p>If this resolver was constructed in read-only mode, this method will always throw <code>PropertyNotWritableException</code>.</p> <p>If a <code>Map</code> was created using  <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/util/Collections.html#unmodifiableMap(java.util.Map)" title="class or interface in java.util"><CODE>Collections.unmodifiableMap(java.util.Map<? extends K, ? extends V>)</CODE></A>, this method must throw <code>PropertyNotWritableException</code>. Unfortunately,  there is no Collections API method to detect this. However, an  implementation can create a prototype unmodifiable <code>Map</code>  and query its runtime type to see if it matches the runtime type of  the base object as a workaround.</p><P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../javax/el/ELResolver.html#setValue(javax.el.ELContext, java.lang.Object, java.lang.Object, java.lang.Object)">setValue</A></CODE> in class <CODE><A HREF="../../javax/el/ELResolver.html" title="class in javax.el">ELResolver</A></CODE></DL></DD><DD><DL>

⌨️ 快捷键说明

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