这是这个问题的后续:Are there any web frameworks for JVM with data binding checked at compilation time?
在那个问题中,公认的答案是 JSP。
我的问题是,是否有任何现代框架(如 Wicket、Play 2.0、Spring MVC、Vaadin、Grails、Tapestry、JSF、GWT 等)支持此编译时绑定(bind)功能?
我知道新手开发者更喜欢没有任何编译时检查的动态绑定(bind),因此该功能已从大多数现代语言和框架中删除。我只想知道他们中是否有任何人保留了对这个特定旧功能的支持,即使它作为一个选项得到支持。
最佳答案
据我所知,Vaadin 8 支持这种与 Java lambda 表达式的绑定(bind)。
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));
有关详细信息,请参阅文档:https://vaadin.com/docs/framework/datamodel/datamodel-forms.html
关于java - 是否有任何 "modern"框架支持在编译时检查数据绑定(bind)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24962609/