elresolver.html

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

HTML
687
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_14) on Mon Jan 28 05:47:05 PST 2008 --><TITLE>ELResolver (Java EE 5)</TITLE><META NAME="keywords" CONTENT="javax.el.ELResolver class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="ELResolver (Java EE 5)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" 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_top_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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../javax/el/ELException.html" title="class in javax.el"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../javax/el/Expression.html" title="class in javax.el"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html?javax/el/ELResolver.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="ELResolver.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<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:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.el</FONT><BR>Class ELResolver</H2><PRE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>  <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>javax.el.ELResolver</B></PRE><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../javax/el/ArrayELResolver.html" title="class in javax.el">ArrayELResolver</A>, <A HREF="../../javax/el/BeanELResolver.html" title="class in javax.el">BeanELResolver</A>, <A HREF="../../javax/el/CompositeELResolver.html" title="class in javax.el">CompositeELResolver</A>, <A HREF="../../javax/servlet/jsp/el/ImplicitObjectELResolver.html" title="class in javax.servlet.jsp.el">ImplicitObjectELResolver</A>, <A HREF="../../javax/el/ListELResolver.html" title="class in javax.el">ListELResolver</A>, <A HREF="../../javax/el/MapELResolver.html" title="class in javax.el">MapELResolver</A>, <A HREF="../../javax/el/ResourceBundleELResolver.html" title="class in javax.el">ResourceBundleELResolver</A>, <A HREF="../../javax/servlet/jsp/el/ScopedAttributeELResolver.html" title="class in javax.servlet.jsp.el">ScopedAttributeELResolver</A></DD></DL><HR><DL><DT><PRE>public abstract class <B>ELResolver</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL></PRE><P>Enables customization of variable and property resolution behavior for EL expression evaluation. <p>While evaluating an expression, the <code>ELResolver</code> associated with the <A HREF="../../javax/el/ELContext.html" title="class in javax.el"><CODE>ELContext</CODE></A> is consulted to do the initial resolution of  the first variable of an expression. It is also consulted when a  <code>.</code> or <code>[]</code> operator is encountered, except for the last such operator in a method expression, in which case the resultion rules are hard coded.</p> <p>For example, in the EL expression <code>${employee.lastName}</code>,  the <code>ELResolver</code> determines what object <code>employee</code> refers to, and what it means to get the <code>lastName</code> property on  that object.</p> <p>Most methods in this class accept a <code>base</code>  and <code>property</code> parameter. In the case of variable resolution (e.g. determining what <code>employee</code> refers to in  <code>${employee.lastName}</code>), the <code>base</code> parameter will  be <code>null</code> and the <code>property</code> parameter will always  be of type <code>String</code>. In this case, if the <code>property</code> is not a <code>String</code>, the behavior of the <code>ELResolver</code> is undefined.</p> <p>In the case of property resolution, the <code>base</code> parameter identifies the base object and the <code>property</code> object identifies the property on that base. For example, in the expression <code>${employee.lastName}</code>, <code>base</code> is the result of the variable resolution for <code>employee</code> and <code>property</code> is the string <code>"lastName"</code>.  In the expression <code>${y[x]}</code>, <code>base</code> is the result of the variable resolution for <code>y</code> and <code>property</code> is the result of the variable resolution for <code>x</code>.</p> <p>Though only a single <code>ELResolver</code> is associated with an <code>ELContext</code>, there are usually multiple resolvers considered for any given variable or property resolution. <code>ELResolver</code>s are combined together using <A HREF="../../javax/el/CompositeELResolver.html" title="class in javax.el"><CODE>CompositeELResolver</CODE></A>s, to define rich semantics for evaluating an expression.</p> <p>For the <A HREF="../../javax/el/ELResolver.html#getValue(javax.el.ELContext, java.lang.Object, java.lang.Object)"><CODE>getValue(javax.el.ELContext, java.lang.Object, java.lang.Object)</CODE></A>, <A HREF="../../javax/el/ELResolver.html#getType(javax.el.ELContext, java.lang.Object, java.lang.Object)"><CODE>getType(javax.el.ELContext, java.lang.Object, java.lang.Object)</CODE></A>, <A HREF="../../javax/el/ELResolver.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> and <A HREF="../../javax/el/ELResolver.html#isReadOnly(javax.el.ELContext, java.lang.Object, java.lang.Object)"><CODE>isReadOnly(javax.el.ELContext, java.lang.Object, java.lang.Object)</CODE></A> methods, an <code>ELResolver</code> is not responsible for resolving all possible (base, property) pairs. In fact, most resolvers will only handle a <code>base</code> of a single type. To indicate that a resolver has successfully resolved a particular (base, property) pair, it must set the <code>propertyResolved</code> property of the <code>ELContext</code> to <code>true</code>. If it could  not handle the given pair, it must leave this property alone. The caller must ignore the return value of the method if <code>propertyResolved</code> is <code>false</code>.</p> <p>The <A HREF="../../javax/el/ELResolver.html#getFeatureDescriptors(javax.el.ELContext, java.lang.Object)"><CODE>getFeatureDescriptors(javax.el.ELContext, java.lang.Object)</CODE></A> and <A HREF="../../javax/el/ELResolver.html#getCommonPropertyType(javax.el.ELContext, java.lang.Object)"><CODE>getCommonPropertyType(javax.el.ELContext, java.lang.Object)</CODE></A> methods are primarily designed for design-time tool support, but must handle invocation at runtime as well. The  <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/beans/Beans.html#isDesignTime()" title="class or interface in java.beans"><CODE>Beans.isDesignTime()</CODE></A> method can be used to determine  if the resolver is being consulted at design-time or runtime.</p><P><P><DL><DT><B>Since:</B></DT>  <DD>JSP 2.1</DD><DT><B>See Also:</B><DD><A HREF="../../javax/el/CompositeELResolver.html" title="class in javax.el"><CODE>CompositeELResolver</CODE></A>, <A HREF="../../javax/el/ELContext.html#getELResolver()"><CODE>ELContext.getELResolver()</CODE></A></DL><HR><P><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Field Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/el/ELResolver.html#RESOLVABLE_AT_DESIGN_TIME">RESOLVABLE_AT_DESIGN_TIME</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The attribute name of the named attribute in the <code>FeatureDescriptor</code> that specifies whether the variable or property can be resolved at runtime.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/el/ELResolver.html#TYPE">TYPE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The attribute name of the named attribute in the <code>FeatureDescriptor</code> that specifies the runtime type of the variable or property.</TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../javax/el/ELResolver.html#ELResolver()">ELResolver</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract &nbsp;<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;</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/el/ELResolver.html#getCommonPropertyType(javax.el.ELContext, java.lang.Object)">getCommonPropertyType</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)</CODE>

⌨️ 快捷键说明

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