strongloop-community / loopback-sdk-android

Android Client SDK for the LoopBack framework.
Other
67 stars 41 forks source link

Object is null #65

Closed brunocascio closed 9 years ago

brunocascio commented 9 years ago

Reponse from loopback api:

[
  {
    "name": "Receta 1",
    "description": "descripcion de la receta 1",
    "servings": 4,
    "preparing_time": 3847384,
    "cooking_time": 2328738,
    "createdAt": "2015-03-05T16:30:34.000Z",
    "userId": 1,
    "id": 1,
    "user": {
      "firstName": "Bruno",
      "lastName": "Cascio",
      "username": "brunocascio",
      "email": "foo@bar.com",
      "facebook_id": null,
      "city": null,
      "createdAt": "2015-03-05T16:30:34.000Z",
      "modifiedAt": "2015-03-05T16:30:34.000Z",
      "id": 1
    },
    "likes": [
      {
        "recipeId": 1,
        "userId": 1
      }
    ],
    "ingredients": [],
    "images": []
  }
]

How to define java class for user?

public class Recipe extends Model {
....    
    private User user;
....
}
public class User extends Model {
....    
    private String firstName;
 ....
}

_NOTE: _ User model is a custom model, not loopback user.

In java, user throws a NullPointerException

bajtos commented 9 years ago

This is a duplicate of #62.