title: Error when getting an object from DataSnapshot
body: <p>I am implementing a database with Firebase for an android application.</p>
  
  <p>I present 2 beans : <code>User.class</code> and <code>Address.class</code>, using by the app :</p>
  
  <pre><code>@IgnoreExtraProperties
  public class User {
  
      @Exclude
      private String idAccount;
      private String firstname;
      private String lastname;
      private String pseudo;
      private Address address;
      private List&lt;Qualification&gt; qualification;
      private boolean isWorker;
  
      // Constructors + getters + setters
  
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class Address {
  
      private String houseNumber;
      private String street;
      private String city;
      private String zip;
      private String country;
  
      // Constructors + getters + setters
  
  }
  </code></pre>
  
  <p>So, I can add an user in the database with <code>usersRef.child(idUser).setValue(user)</code>, where <code>usersRef</code> is my reference of the users in the database (<a href="https://i.stack.imgur.com/HP6td.png" rel="nofollow noreferrer">See result</a>)</p>
  
  <p>I can also get the user with a <code>ValueEventListener</code>:</p>
  
  <pre><code>        Query query = usersRef.child(idUser);
          query.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  User user = dataSnapshot.getValue(User.class);
                  result.call(user);
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
                  throw databaseError.toException();
              }
          });
  </code></pre>
  
  <p>(<a href="https://i.stack.imgur.com/ppMjv.png" rel="nofollow noreferrer">See result</a>)</p>
  
  <p>So, for now all is working !</p>
  
  <p>But, if I try to put a <code>ChildEventListener</code> on my <code>usersRef</code>, I have a crash :</p>
  
  <pre><code> usersRef.addChildEventListener(new ChildEventListener() {
  
              @Override
              public void onChildAdded(DataSnapshot dataSnapshot, String s) {
  
                  User user = dataSnapshot.getValue(User.class); // crash here
                  }
              }
  
              ...
  
  }
  </code></pre>
  
  <blockquote>
    <p>FATAL EXCEPTION: PID: 29470
                                                                         com.google.firebase.database.DatabaseException: Can't convert object
    of type java.lang.String to type ca.uqac.sosdoit.data.Address
                                                                             at com.google.android.gms.internal.zzear.zzb(Unknown Source)
                                                                             at com.google.android.gms.internal.zzear.zza(Unknown Source)
                                                                             at com.google.android.gms.internal.zzear.zzb(Unknown Source)
                                                                             at com.google.android.gms.internal.zzeas.zze(Unknown Source)
                                                                             at com.google.android.gms.internal.zzear.zzb(Unknown Source)
                                                                             at com.google.android.gms.internal.zzear.zza(Unknown Source)
                                                                             at com.google.firebase.database.DataSnapshot.getValue(Unknown Source)
                                                                             at
    ca.uqac.sosdoit.database.DatabaseManager$1.onChildAdded(DatabaseManager.java:68)
                                                                             at com.google.android.gms.internal.zzdri.zza(Unknown Source)
                                                                             at com.google.android.gms.internal.zzdwu.zzbvb(Unknown Source)
                                                                             at com.google.android.gms.internal.zzdxa.run(Unknown Source)
                                                                             at android.os.Handler.handleCallback(Handler.java:808)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:103)
                                                                             at android.os.Looper.loop(Looper.java:193)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5292)
                                                                             at java.lang.reflect.Method.invokeNative(Native Method)
                                                                             at java.lang.reflect.Method.invoke(Method.java:515)
                                                                             at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
                                                                             at dalvik.system.NativeStart.main(Native Method)</p>
  </blockquote>
  
  <p>And I absolutely don't know why</p>