On Thu, 2004-11-04 at 00:52 -0500, Scott Palmer wrote:
...
> This is true.  Though I'm not considering that a digit will ever follow 
> a '$' when used in an identifier.  In my case a digit would only be 
> considered as a property of an identifier, or rather the object 
> represented by that identifier, only in a case such as $ident.0  or 
> $ident.0.something. And even then only if the object referenced by 
> $ident had a "get0()" method or was a map with a "0" among the keys.
> 
> But I've given up nonetheless :)

Scott, do not give up hope!  You can implement a generic get(String)
method which can provide this functionality in a dynamic fashion:

public class Ident
{
    public Client get(String name)
    {
        ...
    }
}

$ident.foo will map to Ident.get("foo"), which you can in turn have
return your Client object.  Here's a link to the gory details:

<http://cvs.apache.org/viewcvs.cgi/jakarta-
velocity/src/java/org/apache/velocity/runtime/parser/node/GetExecutor.java?rev=1&view=auto>

And an example of an implementation which I use every day in production
for L10N:

<http://jakarta.apache.org/turbine/turbine/turbine-2.3.1/apidocs/org/apache/turbine/services/localization/LocalizationTool.html#get(java.lang.String)>



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

Reply via email to