velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Access public properties
Date Wed, 23 Feb 2011 15:20:49 GMT

On 2/18/2011 1:02 AM, David Parks wrote:
> If I have an object such as:
> public class Thing {
>    public String theThing = "Something stringy";
> }
> And I place a Thing object in the context as variable $thing, I cannot
> access:
> $thing.theThing

See the section "Case Substitution". This section really ought to be
called something like "resolving data references" or something like that.

At any rate, Velocity uses bean-style introspection to discover
attributes, and attributes are never members: they are always methods.

> Or did I miss something? Seems like public properties would be naturally
> supported.

Unfortunately not. It also means that you can't use things like
Boolean.TRUE in your templates. :(

> Seems reasonable that Velocity would check for a public property if
> the getter isn't there.

It's probably not going to happen, but you are free to modify the
introspector to suit your own needs. And, as always, patches are always


View raw message