I'm working with an api that uses HAL (Hypertext Application Language) and in some responses it includes fields like
"_links": {
"self": { "href": "/account" },
"numbers": { "href": "/numbers" },
"menus": { "href": "/menus" },
"applications": { "href": "/applications" },
"messages": { "href": "/messages" }
},
that is a part of hal. I had searched and found halarious library and trying to integrate it with my retrofit api. The POJO that is converted is:
public class User {
@Expose(serialize = false, deserialize = true)
@HalLink
private String links;
@SerializedName("id")
private String mRemoteId;
@SerializedName("name")
private String mName;
}
and the gson and retrofit config is:
Gson gson = new GsonBuilder()
.registerTypeAdapterFactory(new HalDeserializer(AccountResponse.class))
.create();
RestAdapter restAdapter = new RestAdapter.Builder()
.setLogLevel(RestAdapter.LogLevel.FULL)
.setEndpoint(BASE_URL)
.setConverter(new UsersConverter())
.build();
I want to know what should i do next to have this work?