Actually, you can use public static final properties (constants) by putting the class in the context:
context.put("Boolean", Boolean.class); $Boolean.TRUE since 1.6, i believe. On Wed, Feb 23, 2011 at 7:20 AM, Christopher Schultz <ch...@christopherschultz.net> wrote: > David, > > 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 > > http://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html > > 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 > welcome. > > -chris > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org