Skip to content

Instantly share code, notes, and snippets.

@softprops
Forked from snooplsm/gist:641212
Created October 22, 2010 19:24
Show Gist options
  • Select an option

  • Save softprops/641214 to your computer and use it in GitHub Desktop.

Select an option

Save softprops/641214 to your computer and use it in GitHub Desktop.
import java.io.Serializable;
import org.codehaus.jackson.annotate.JsonProperty;
public class Foo implements Serializable {
private static final long serialVersionUID = 1L;
@JsonProperty("id")
private Long id;
@JsonProperty("n")
private String name;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public List<Foo> list(Long id) throws Exception {
HttpResponse response = client.execute(post(url, params("foo_id", id)));
return mapper.readValue(
response.getEntity().getContent(),
TypeFactory.collectionType(List.class, Foo.class)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment