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

📄 apa.html

📁 ONGL学习的好书,介绍ONGL的相关知识
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Appendix&nbsp;A.&nbsp;OGNL Language Reference</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 Language Guide"><link rel="up" href="index.html" title="OGNL Language Guide"><link rel="previous" href="coerceCollection.html" title="Interpreting Objects as Collections"></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">Appendix&nbsp;A.&nbsp;OGNL Language Reference</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="coerceCollection.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;</td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="N10614"></a>Appendix&nbsp;A.&nbsp;<span class="acronym">OGNL</span> Language Reference</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="apa.html#operators">Operators</a></span></dt></dl></div><p>This section has a fairly detailed treatment of <span class="acronym">OGNL</span>'s syntax and implementation. See below for a complete table of <span class="acronym">OGNL</span>'s operators, a section on how <span class="acronym">OGNL</span> coerces objects
        to various types, and a detailed description of <span class="acronym">OGNL</span>'s basic expressions.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="operators"></a>Operators</h2></div></div><div></div></div><p><span class="acronym">OGNL</span> borrows most of Java's operators, and adds a few new ones. For the most part, <span class="acronym">OGNL</span>'s treatment of a given operator is the same as Java's, with the important caveat that
            <span class="acronym">OGNL</span> is essentially a typeless language. What that means is that every value in <span class="acronym">OGNL</span> is a Java object, and <span class="acronym">OGNL</span> attempts to coerce from each object a meaning appropriate to the
            situation it is used in (see the section on <a href="coercion.html" title="Chapter&nbsp;5.&nbsp;Coercing Objects to Types">coercion</a>).</p><p>The following table lists <span class="acronym">OGNL</span> operators in reverse precedence order. When more than one operator is listed in the same box, these operators have the same precedence and are evaluated in left-to-right order.</p><div class="table"><a name="N10644"></a><p class="title"><b>Table&nbsp;A.1.&nbsp;<span class="acronym">OGNL</span> Operators</b></p><table summary="OGNL Operators" border="1"><colgroup><col><col><col></colgroup><thead><tr><th valign="top">Operator</th><th valign="top"><tt class="function">getValue()</tt> Notes</th><th valign="top"><tt class="function">setValue()</tt> Notes</th></tr></thead><tbody><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal">,</tt> <i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Sequence operator</p></dd></dl></div></td><td valign="top">Both <tt class="varname">e1</tt> and <tt class="varname">e2</tt> are evaluated with the same source object, and the result of <tt class="varname">e2</tt> is returned.</td><td valign="top"><tt class="function">getValue</tt> is called on <tt class="varname">e1</tt>, and then <tt class="function">setValue</tt> is called on <tt class="varname">e2</tt>.</td></tr><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">=</tt> <i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Assignment operator</p></dd></dl></div></td><td valign="top"><tt class="function">getValue</tt> is called on <tt class="varname">e2</tt>, and then <tt class="function">setValue</tt> is called on <tt class="varname">e1</tt> with the result of <tt class="varname">e2</tt> as the target object.</td><td valign="top">Cannot be the top-level expression for <tt class="function">setValue</tt>.</td></tr><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">?</tt> <i class="replaceable"><tt>e2</tt></i> <tt class="literal">:</tt> <i class="replaceable"><tt>e3</tt></i></span></dt><dd><p>Conditional
                            operator</p></dd></dl></div></td><td valign="top"><tt class="function">getValue</tt> is called on <tt class="varname">e1</tt> and the result is <a href="coercion.html#coerceBoolean" title="Interpreting Objects as Booleans">interpreted as a boolean</a>. <tt class="function">getValue</tt> is then called on either
                            <tt class="varname">e2</tt> or <tt class="varname">e3</tt>, depending on whether the result of <tt class="varname">e1</tt> was <tt class="constant">true</tt> or <tt class="constant">false</tt> respectively, and the result is returned.</td><td valign="top"><tt class="function">getValue</tt> is called on <tt class="varname">e1</tt>, and then <tt class="function">setValue</tt> is called on either <tt class="varname">e2</tt> or <tt class="varname">e3</tt>.</td></tr><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">||</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term">e1 <tt class="literal"> or </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Logical
                            <span class="keycode">or</span> operator</p></dd></dl></div></td><td valign="top"><tt class="function">getValue</tt> is called on <tt class="varname">e1</tt> and the result is <a href="coercion.html#coerceBoolean" title="Interpreting Objects as Booleans">interpreted as a boolean</a>. If <tt class="constant">true</tt>, that result is returned;
                            if <tt class="constant">false</tt>, <tt class="function">getValue</tt> is called on <tt class="varname">e2</tt> and its value is returned.</td><td valign="top"><tt class="function">getValue</tt> is called on <tt class="varname">e1</tt>; if <tt class="constant">false</tt>, <tt class="function">setValue</tt> is called on <tt class="varname">e2</tt>. Note that <tt class="varname">e1</tt> being
                            <tt class="constant">true</tt> prevents any further setting from taking place.</td></tr><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">&amp;&amp;</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> and </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Logical
                            <span class="keycode">and</span> operator</p></dd></dl></div></td><td valign="top"><tt class="function">getValue</tt> is called on <tt class="varname">e1</tt> and the result is <a href="coercion.html#coerceBoolean" title="Interpreting Objects as Booleans">interpreted as a boolean</a>. If <tt class="constant">false</tt>, that result is returned;
                            if true, <tt class="function">getValue</tt> is called on e2 and its value is returned.</td><td valign="top"><tt class="function">getValue</tt> is called on <tt class="varname">e1</tt>; if <tt class="constant">true</tt>, <tt class="function">setValue</tt> is called on <tt class="varname">e2</tt>. Note that <tt class="varname">e1</tt> being
                            <tt class="constant">false</tt> prevents any further setting from taking place.</td></tr><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">|</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> bor </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Bitwise
                            <span class="keycode">or</span> operator</p></dd></dl></div></td><td valign="top"><tt class="varname">e1</tt> and <tt class="varname">e2</tt> are <a href="coerceInteger.html" title="Interpreting Objects as Integers">interpreted as integers</a> and the result is an <span class="type">integer</span>.</td><td valign="top">Cannot be the top-level expression passed to <tt class="function">setValue</tt>.</td></tr><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">^</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> xor </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Bitwise
                            exclusive-or operator</p></dd></dl></div></td><td valign="top"><tt class="varname">e1</tt> and <tt class="varname">e2</tt> are <a href="coerceInteger.html" title="Interpreting Objects as Integers">interpreted as integers</a> and the result is an <span class="type">integer</span>.</td><td valign="top">Cannot be the top-level expression passed to <tt class="function">setValue</tt>.</td></tr><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">&amp;</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> band </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Bitwise
                            and operator</p></dd></dl></div></td><td valign="top"><tt class="varname">e1</tt> and <tt class="varname">e2</tt> are <a href="coerceInteger.html" title="Interpreting Objects as Integers">interpreted as integers</a> and the result is an <span class="type">integer</span>.</td><td valign="top">Cannot be the top-level expression passed to <tt class="function">setValue</tt>.</td></tr><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">==</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> eq </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Equality
                            test</p></dd><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">!=</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> neq </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Inequality
                            test</p></dd></dl></div></td><td valign="top">Equality is tested for as follows. If either value is <tt class="constant">null</tt>, they are equal if and only if both are <tt class="constant">null</tt>. If they are the same object or the
                            <tt class="function">equals()</tt> method says they are equal, they are equal. If they are both <tt class="classname">Number</tt>s, they are equal if their values as double-precision floating point numbers are equal. Otherwise,
                            they are not equal. These rules make numbers compare equal more readily than they would normally, if just using the equals method.</td><td valign="top">Cannot be the top-level expression passed to <tt class="function">setValue</tt>.</td></tr><tr><td valign="top"><div class="variablelist"><dl><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">&lt;</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> lt </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Less
                            than comparison</p></dd><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">&lt;=</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> lte </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Less
                            than or equals comparison</p></dd><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">&gt; </tt><i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> gt
                            </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Greater than comparison</p></dd><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">&gt;=</tt> <i class="replaceable"><tt>e2</tt></i>, </span><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal">
                            gte </tt><i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>Greater than or equals comparison</p></dd><dt><span class="term"><i class="replaceable"><tt>e1</tt></i><tt class="literal"> in</tt>
                            <i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>List membership comparison</p></dd><dt><span class="term"><i class="replaceable"><tt>e1</tt></i> <tt class="literal">not in</tt> <i class="replaceable"><tt>e2</tt></i></span></dt><dd><p>List
                            non-membership comparison</p></dd></dl></div></td><td valign="top">The ordering operators compare with <tt class="function">compareTo()</tt> if their arguments are non-numeric and implement <tt class="classname">Comparable</tt>; otherwise, the arguments are interpreted as
                            numbers and compared numerically. The in operator is not from Java; it tests for inclusion of e1 in e2, where e2 is interpreted as a collection. This test is not efficient: it iterates the collection. However, it uses the

⌨️ 快捷键说明

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