2

JFace Databinding doesn't support generics, so it isn't particularly type-safe. And apparently it never will, since they wish to preserve Java 1.3 support.

JGoodies supports generics since 2.0.0. Has anyone ported JGoodies 2 to SWT/JFace? Or is there another library which allows both?

Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
  • 1
    On a related issue: I recently needed a version of org.eclipse.core.databinding.property and .observable with generics, so I added them. Available there: https://github.com/jppellet/org.eclipse.core.databinding.property and https://github.com/jppellet/org.eclipse.core.databinding.observable – Jean-Philippe Pellet Feb 21 '12 at 12:47

2 Answers2

2

JFace Databinding doesn't support generics, so it isn't particularly type-safe. And apparently it never will, since they wish to preserve Java 1.3 support.

Just want to provide clarification. Going forward we are targeting Java 5 and planning to retool the API to use generics.

Stay tuned.

-- Matthew (project committer)

qualidafial
  • 6,674
  • 3
  • 28
  • 38
0

Unfortunately, the JFace binding framework is typeless, which is why I don't use it.

Let's say 'person' is a pojo with a getName() method.

bindingContext.bindValue(SWTObservables.observeText(name, SWT.Modify), PojoObservables.observeValue(person, "name"));

If you change the getName() method, to getEntireName(), the compiler will not catch anything for you - you'll get a runtime exception.

I use a controller between my model and JFace and deal with it that way. I'm not willing to give up the typing.

andyczerwonka
  • 4,230
  • 5
  • 34
  • 57
  • What you've observed is a weakness of the JavaBeans specification itself. POJOs and JavaBeans will suffer from this refactoring issue until Java introduces real property support. Which may never happen. – qualidafial Dec 09 '10 at 22:37