Hi, I'm still gathering around TornadoFX. I'm curr...
# tornadofx
Hi, I'm still gathering around TornadoFX. I'm currently playing with ViewModels and bindings. One thing I noticed, is that depending on the origin of the object binding doesn't work as I expect. If this is normal, please tell me, I'll be glad to know how it really works. I got a POJO that I try to bind with an ItemViewModel
Copy code
public class PersonJava {
        private String name;
        private String title;
        // and so on...
    class PersonJavaModel : ItemViewModel<PersonJava>() {
        val name = bind { item?.observable(PersonJava::getName, PersonJava::setName) }
        val title = bind { item?.observable(PersonJava::getTitle, PersonJava::setTitle) }
This works pretty well. Now, I tried to do the same with a data class
Copy code
data class PersonKotlin(var name: String? = null, var title: String? = null)

    class PersonKotlinModel : ItemViewModel<PersonKotlin>() {
        val name = bind { item?.observable(PersonKotlin::name) }
        val title = bind { item?.observable(PersonKotlin::title) }
Here the bind function doesn't agree because my props are nullable. But why does this work with POJOs ? they nullable too. + I tried to put the annotation @nullable on my POJO's props and this end with a compile exepction like with my data class, because my getters retrieve String? instead of String!, the type inference does its job here. With my POJO I still can manipulate instances with null values in my UI and this works fine. So why I cannot use nullable values with data classes and ItemViewModel ?