views:

121

answers:

2
+1  Q: 

JavaBeans and DSLs

It's 2009 and we still all hold on the JavaBeans despite all their flaws, mostly because of the tooling support which we wrote in our own blood.

But now we have method chaining and internal DSLs and some pressure to replace or extend JavaBeans with DSL classes. Has anyone an implementation that implements PropertyDescriptor for a DSL (where the getters and setter use the exact same name as the property) and a way to hook that into the Java RT so I don't need to create them all by myself?

+1  A: 

I am not sure if it's what you need, but maybe it can help you, if you look at the BeanWrapper in Spring: org.springframework.beans.BeanWrapperImpl (see the docs)

Ilya Boyandin
A: 

Use groovy scripting language which works top on jvm. Groovy have first class support of writing DSL.

Silent Warrior
That's true but it will cause more pain. When using groovy, I'll either can't use method chaining or I suddenly have two methods to change a property.
Aaron Digulla