⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classreferences.html

📁 ONGL学习的好书,介绍ONGL的相关知识
💻 HTML
字号:
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter&nbsp;5.&nbsp;Class References</title><link href="../docbook.css" rel="stylesheet" type="text/css"><meta content="DocBook XSL Stylesheets V1.65.0" name="generator"><link rel="home" href="index.html" title="OGNL Developer Guide"><link rel="up" href="index.html" title="OGNL Developer Guide"><link rel="previous" href="elementsAccessors.html" title="Chapter&nbsp;4.&nbsp;Elements Accessors"><link rel="next" href="typeConversion.html" title="Chapter&nbsp;6.&nbsp;Type Conversion"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Chapter&nbsp;5.&nbsp;Class References</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="elementsAccessors.html"><img src="../images/navigation/prev.gif" alt="Prev"></a>&nbsp;</td><th align="center" width="60%">&nbsp;</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="typeConversion.html"><img src="../images/navigation/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="classReferences"></a>Chapter&nbsp;5.&nbsp;Class References</h2></div></div><div></div></div><p>In the sections on accessing static field and static methods it stated that classes must be full-specified in between the class reference specifier (<tt class="constant">@</tt><tt class="classname">&lt;classname&gt;</tt><tt class="constant">@</tt><span class="property">&lt;field|method&gt;</span><tt class="constant">@</tt>).
        This is not entirely true; the default <tt class="classname">ClassResolver</tt> simply looks up the name of the class and assumes that it is fully specified. The <tt class="classname">ClassResolver</tt> interface is included in the
        <span class="acronym">OGNL</span> context to perform lookup of classes when an expression is evaluated. This makes it possible to specify, for example, a list of imports that are specific to a particular <tt class="function">setValue()</tt> or
        <tt class="function">getValue()</tt> context in order to look up classes. It also makes class references agreeably short because you don't have to full specify a class name.</p><pre class="programlisting">public interface ClassResolver
{
    public Class classForName(Map context, String className) throws ClassNotFoundException;
}</pre><p>You can set a class resolver on a context basis using the <tt class="classname">Ognl</tt> methods <tt class="methodname">addDefaultContext()</tt> and <tt class="methodname">createDefaultContext()</tt>.</p></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="elementsAccessors.html"><img src="../images/navigation/prev.gif" alt="Prev"></a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="index.html"><img src="../images/navigation/up.gif" alt="Up"></a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="typeConversion.html"><img src="../images/navigation/next.gif" alt="Next"></a></td></tr><tr><td valign="top" align="left" width="40%">Chapter&nbsp;4.&nbsp;Elements Accessors&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="index.html"><img src="../images/navigation/home.gif" alt="Home"></a></td><td valign="top" align="right" width="40%">&nbsp;Chapter&nbsp;6.&nbsp;Type Conversion</td></tr></table></div></body></html>

⌨️ 快捷键说明

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