📄 propertyaccessors.html
字号:
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 2. Property Accessors</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="extendingOGNL.html" title="Extending OGNL"><link rel="next" href="methodAccessors.html" title="Chapter 3. Method Accessors"></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 2. Property Accessors</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="extendingOGNL.html"><img src="../images/navigation/prev.gif" alt="Prev"></a> </td><th align="center" width="60%"> </th><td align="right" width="20%"> <a accesskey="n" href="methodAccessors.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="propertyAccessors"></a>Chapter 2. Property Accessors</h2></div></div><div></div></div><p>When navigating an <span class="acronym">OGNL</span> expression many of the elements that are found are properties. Properties can be many things depending on the object being accessed. Most of the time these property names resolve to JavaBeans
properties that conform to the set/get pattern. Other objects (such as <tt class="classname">Map</tt>) access properties as keyed values. Regardless of access methodology the OGNL syntax remains the same. Under the hood, however, there are
<tt class="classname">PropertyAccessor</tt> objects that handle the conversion of property name to an actual access to an objects' properties.</p><pre class="programlisting">public interface PropertyAccessor
{
Object getProperty( Map context, Object target, Object name ) throws OgnlException;
void setProperty( Map context, Object target, Object name, Object value ) throws OgnlException;
}</pre><p>You can set a property accessor on a class-by-class basis using <tt class="methodname">OgnlRuntime.setPropertyAccessor()</tt>. There are default property accessors for <tt class="classname">Object</tt> (which uses JavaBeans patterns to extract
properties) and <tt class="classname">Map</tt> (which uses the property name as a key).</p></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="extendingOGNL.html"><img src="../images/navigation/prev.gif" alt="Prev"></a> </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%"> <a accesskey="n" href="methodAccessors.html"><img src="../images/navigation/next.gif" alt="Next"></a></td></tr><tr><td valign="top" align="left" width="40%">Extending OGNL </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%"> Chapter 3. Method Accessors</td></tr></table></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -