Author: wglass
Date: Mon Jul 25 21:16:20 2005
New Revision: 225227

URL: http://svn.apache.org/viewcvs?rev=225227&view=rev
Log:
Added documentation for property lookup.  Thanks to Bill Boland.

http://issues.apache.org/bugzilla/show_bug.cgi?id=10455

Modified:
    jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml

Modified: jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml
URL: 
http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml?rev=225227&r1=225226&r2=225227&view=diff
==============================================================================
--- jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml (original)
+++ jakarta/velocity/core/trunk/xdocs/docs/user-guide.xml Mon Jul 25 21:16:20 
2005
@@ -29,6 +29,7 @@
         <li><a href="#Variables">Variables</a></li>
         <li><a href="#Properties">Properties</a></li>
         <li><a href="#Methods">Methods</a></li>
+        <li><a href="#Property Lookup Rules">Property Lookup Rules</a></li>
     </ol>
 </li>
 <li><a href="#Formal Reference Notation">Formal Reference Notation</a></li>
@@ -522,6 +523,32 @@
 $book.setTitle( "Homage to Catalonia" )
 ## Can't pass a parameter list
 ]]></source>
+
+ <p>
+    <a name="Property Lookup Rules"><strong>Property Lookup Rules</strong></a>
+    <br/>
+    As was mentioned earlier, properties often refer to methods of the
+    parent object. Velocity is quite clever when figuring out which method
+    corresponds to a requested property. It tries out different alternatives
+    based on several established naming conventions. The exact lookup
+    sequence depends on whether or not the property name starts with
+    an upper-case letter. For lower-case names, such as
+    <em>$customer.address</em>, the sequence is
+    <ol>
+     <li>getaddress()</li>
+     <li>getAddress()</li>
+     <li>get("address")</li>
+     <li>isAddress()</li>
+    </ol>
+    For upper-case property names like <em>$customer.Address</em>, it is
+    slightly different:
+    <ol>
+     <li>getAddress()</li>
+     <li>getaddress()</li>
+     <li>get("Address")</li>
+     <li>isAddress()</li>
+    </ol>
+ </p>
 
  <p>
     <a name="Formal Reference Notation"><strong>Formal Reference 
Notation</strong></a>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to