Are there any web frameworks for JVM with data binding checked at compile time?

Usually when you bind some property to some element on the www page, you will know about typo when testing.

I'm looking for a web framework that, at compile time, will give me an error that I made a binding error ("property not found" or something similar), and if my IDE has a valid refactoring mechanism, this rename property will also affect binding (and vice versa) or, in other words, that renaming will not break the code.

Is there such a framework for the JVM?

I'm new to the JVM world, so I don't know the specifics of JVM frameworks (generally, not just this feature I'm asking for).

+3


source to share


3 answers


JSP development in Eclipse can do this



+1


source


I have implemented a static-whisker library to create a templating engine based on the whisker syntax.

It checks for both syntax errors and type errors (like a missing property) at compile time. It requires a zero-link configuration as the default annotation processor.



The templates remain pure whisker templates, with all the type information extracted from the regular Java class used for rendering.

+2


source


Vaadin frame

Vaadin 8+ supports this kind of binding with Java yambda expressions.

There is a special Binder

class:

Binder<Person> binder = new Binder<>();
TextField titleField = new TextField();

// Start by defining the Field instance to use
binder.forField(titleField)
  // Finalize by doing the actual binding to the Person class
  .bind(
    // Callback that loads the title from a person instance
    Person::getTitle,
    // Callback that saves the title in a person instance
    Person::setTitle));

      

See the docs for details: https://vaadin.com/docs/framework/datamodel/datamodel-forms.html

+1


source







All Articles