Some days ago, Bean Bindings 1.0 has been released – also known as JSR 295 (and as the JSR suggests, this may be added to the Java very soon).
I really love bindings. And I use JGoddies Binding very often. But the JGoodies Bindings has one big disadvantage. The binding is done based on strings.
You have to write something like that to bind a property:
PropertyAdapter adapter = new PropertyAdapter(bean, "propertyName", true);
The problem is, that it is necessary to write the name of the property as String. It is very hard to refactor that code later… And it is impossible for the compiler to verify it (without a major improvement).
But as we don’t have any better support build into Java now, it is better than nothing (as said, I use it often)…
And now there is this JSR. And they work really hard on that binding issue. And they talk and write and talk and write and finally release version 1.0. And what must I see?
Property firstP = BeanProperty.create("firstName");
That is exactly the same code (in its essence) as the other Binding Frameworks use. And this is *not* the way. Java has its weaknesses. But one of the most important strengths is the strict compiler…
Integrating sublanguages as EL into Java complicates everything: Compiler, Code Editors, GUI Tools….
I prefer waiting another two years for a good solution based on some other language feature (such as closures) than adding such an awful thing…
To be clear: I don’t criticize the details of the implementation. I didn’t even take a look at the code. I am sure it is done very well. All I hate is that awful string based thing…