From: Lane S. <la...@sa...> - 2002-11-15 16:23:15
|
Hi Paul, Thanks for the observation. In general, the thinking is this: $BeanRef. + "get" + "Method" maps to the bean signature and respects the bean signature protocol so that $BeanRef.Foo is well distinguished from the member reference: Object foo. Your proposal would become ambiguous and impose some additional overhead which we are very careful about avoiding. public class MyBean { public Hashtable foo; public String getFoo() { return foo.get("bar").toString(); } } The introspection engine design likes that it can provide $BeanRef.foo and $BeanRef.Foo as distinct references efficiently and that under your proposal, the selection would get the member when you probably wanted the method. <newQuestion> When writing a web app with lots of templates. How do you like to get templates parsed once? In other words, if you have a template file, global.wmt, and, it changes rarely, do you include it at the top of every template, or do you use another technique? Please advise on this and any other "BestPractices" which I am compiling for release 1.1 </> -lane Paul G. Weiss wrote: >Please correct me if I'm wrong, but I was under the impression that the >Bean specification held that a property named "foo" would have >accessor methods: > > public Type getFoo() > public void setFoo(Type t) > >i.e. the letter case of the first letter of the property name reverses >itself when defining the name of the property. > >This is the pattern in all of the example code provided by Sun, as >well as the Bean Serializer in the Apache SOAP package. > >Yet, webmacro (at least 1.0.1, I haven't tried 1.1b1) seems to have >it the other way. In other words if I have a variable $var of my bean >type, webmacro will not expand $var.foo when I have the methods >indicated above, but it will expand $var.Foo. > >This seems like a bug to me, although difficult to fix in light of the >existing templates that must be out there. Perhaps webmacro >ought to try both variants, i.e. if it see $var.pname it should look >for getPname() as well as getpname() ( and I would argue that it >should be in that order). > >Comments? >-Paul Weiss > > > >------------------------------------------------------- >This sf.net email is sponsored by: To learn the basics of securing >your web site with SSL, click here to get a FREE TRIAL of a Thawte >Server Certificate: http://www.gothawte.com/rd524.html >_______________________________________________ >Webmacro-user mailing list >Web...@li... >https://lists.sourceforge.net/lists/listinfo/webmacro-user > > > |