velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Parks" <davidpark...@yahoo.com>
Subject Access public properties
Date Fri, 18 Feb 2011 06:02:17 GMT
If I have an object such as:

 

$thing

 

Which is the following class-type:

 

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

 

L  booo hooo

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

 

If I add a public getter this works fine. So I have a perfectly fine
workaround.

 

I know getters/setters are good practice, but for internal stuff that won't
be extended I sometimes package things like compound return statements into
a simple object with a few public properties for easy access. Seems
reasonable that Velocity would check for a public property if the getter
isn't there.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message