Does Freemarker support DynaBean?

3 messages Options
Embed this post
Permalink
JeremyChone

Does Freemarker support DynaBean?

Reply Threaded More More options
Print post
Permalink
http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/DynaBean.html

Basically, I would like to be able to do ${myDynaBean.propOne} where myDynaBean is a Common DynaBean. Is that possible, or do I need to get my own BeanWrapper for this type? 

Jeremy

--
Jeremy Chone
+1 415 699 9912
CTO, VP Product Development and Operations,
www.iJuris.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Attila Szegedi-3

Re: Does Freemarker support DynaBean?

Reply Threaded More More options
Print post
Permalink
If you use BeansWrapper, then yes, you will be able to do that. This  
is due to the fact that if the object has no static property of the  
requested name, but does have either a "public <any-return-value> get
(Object)" or "public <any-return-value> get(String)" method, then its  
BeanModel wrapper will invoke that. This works for any class declaring  
a get() method, without the need to declare any particular interface.  
So, it accidentally works with DynaBean :-) If Apache folks would've  
named the method something other than get(), you'd be out of luck :-)

Attila.

On 2009.10.14., at 23:02, Jeremy Chone wrote:

> http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/DynaBean.html
>
> Basically, I would like to be able to do ${myDynaBean.propOne} where  
> myDynaBean is a Common DynaBean. Is that possible, or do I need to  
> get my own BeanWrapper for this type?
>
> Jeremy
>
> --
> Jeremy Chone
> +1 415 699 9912
> CTO, VP Product Development and Operations,
> www.iJuris.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
JeremyChone

Re: Does Freemarker support DynaBean?

Reply Threaded More More options
Print post
Permalink
I use BeansWrapper.DEFAULT_WRAPPER, so I guess that should work. 

BTW, this is cool, and should resolve my other requirements about "on demand" properties. 

Jeremy,


On Wed, Oct 14, 2009 at 10:46 PM, Attila Szegedi <[hidden email]> wrote:
If you use BeansWrapper, then yes, you will be able to do that. This
is due to the fact that if the object has no static property of the
requested name, but does have either a "public <any-return-value> get
(Object)" or "public <any-return-value> get(String)" method, then its
BeanModel wrapper will invoke that. This works for any class declaring
a get() method, without the need to declare any particular interface.
So, it accidentally works with DynaBean :-) If Apache folks would've
named the method something other than get(), you'd be out of luck :-)

Attila.

On 2009.10.14., at 23:02, Jeremy Chone wrote:

> http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/DynaBean.html
>
> Basically, I would like to be able to do ${myDynaBean.propOne} where
> myDynaBean is a Common DynaBean. Is that possible, or do I need to
> get my own BeanWrapper for this type?
>
> Jeremy
>
> --
> Jeremy Chone
> +1 415 699 9912
> CTO, VP Product Development and Operations,
> www.iJuris.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user



--
Jeremy Chone
+1 415 699 9912
CTO, VP Product Development and Operations,
www.iJuris.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user