title: LiveData update on object field change
body: <p>I'm using Android MVVM architecture with LiveData. I have an object like this</p>
  <pre><code>public class User {
      private String firstName;
      private String lastName;
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  }
  </code></pre>
  <p>And my view model looks like this</p>
  <pre><code>public class InfoViewModel extends AndroidViewModel {
      MutableLiveData&lt;User&gt; user = new MutableLiveData&lt;&gt;();
  
      public InfoViewModel(@NonNull Application application) {
          super(application);
          User user = new User();
          user.setFirstName(&quot;Alireza&quot;);
          user.setLastName(&quot;Ahmadi&quot;);
  
          this.user.setValue(user);
      }
  
      public LiveData&lt;User&gt; getUser(){
          return user;
      }
  
      public void change(){
          user.getValue().setFirstName(user.getValue().getFirstName() + &quot; A &quot;);
      }
  }
  </code></pre>
  <p>How can I make sure when some field in user object changes observers get notified? BTW it is important to me to keep this data in the separate object and not use primary values like Strings in my ViewModel.</p>