As it is known freemarkers beanwrapper uses the BeanIntrospector of java. That has a consequence that wrapped Boolean cannot have an “is” method for it’s public gets but just has to be a plain get method.
Now I’m working on a project where all of the sudden it became obvious primitive booleans had to become Boolean … Odd situation ofcourse but we are here. Ofcourse all the freemarkers don’t work anymore.
I was wondering if anyone knows, that there is somewhere on the net some BeanWrapper written for freemarker that doesn’t use the BeanIntrospector but some other way to allow Booleans to have is method getters ? Reason I’m asking is because I could try and write my own but the project just doesn’t allow the time for it. I have been googling for a while but can’t come up with anything (mostly since google seems to take Boolean and boolean as the same word …)
If there isn’t any … I’m just going to let one of the juniors change all is methods to get … thats gonna be a fun task for that guy …
Thanks in advance
Kenny
I can’t point to any solution that you can just download. But this is actually quite easy to do by overriding
finetuneMethodAppearancein BeansWrapper. There you can make a fake property from any method. See the related part of the JavaDocs.OTOH, probably the best thing to do is changing those methods to
getmethods, because FreeMarker is not the only component that adheres to the JavaBeans spec. So, even if you fix this in FreeMarker, you can still run into the same problem elsewhere.