Custom object two-way databinding android:text
<p>I've created myself some simple class for validating fields through two-way databinding.</p>

<pre><code>public class ValidatedField extends BaseObservable{
            private String mValue;

            @Bindable
            public String getValue()
            {
                return mValue;
            }


            public void setValue(String value)
            {
                if(Objects.equals(value, mValue)) return;

                mValue = value;
                notifyPropertyChanged(BR.value);
            }
    ...
}
</code></pre>

<p>In ViewModel I setup this class and bind it to view as usual in databinding
(all binding actually works so no error here).</p>

<pre><code>public ValidatedField phoneNumber = new ValidatedField();
</code></pre>

<p>In layout, I have view with android:text property and I setup:</p>

<pre><code>&lt;EditText
   android:text="@={viewModel.phoneNumber.value}" 
/&gt; 
</code></pre>

<p>And everything works like a charm.</p>

<p>And my question is: <strong>is it possible to skip '.value' from layout</strong> so that it looks like this:</p>

<pre><code>&lt;EditText
   android:text="@={viewModel.phoneNumber}" 
/&gt;
</code></pre>

<p>I could make it work if it was one way binding e.g. through binding conversion like this:</p>

<pre><code>@BindingConversion
public static String convertValidatedFieldToString(ValidatedField field){
    return field.getValue();
}
</code></pre>

<p>But I'm not able to set new value to existing ValidatedField.
I've tried to use @InverseBindingAdapter but that's without luck because it would create every time new object and not just updated value of existing one.</p>

<pre><code>@InverseBindingAdapter(attribute = "android:text")
public static ValidatedField convertStringToValidatedField(TextView view)
{
    return new ValidatedField(view.getText().toString());
}
</code></pre>

<p>Thank you!</p>

<hr>

<p><strong>Edit:</strong> 
I should've said that I have other @Bindable fields in the class. e.g: </p>

<pre><code>@Bindable
public boolean getIsError()
{
    return mIsError;
}
</code></pre>