@Test public void deserialize_photo_from_value() { Map<String, Object> photoMap = new HashMap(); Map<String, Object> linksNode = new HashMap(); linksNode.put("self", "http: photoMap.put("links", linksNode); Map<String, Object> dataNode = new HashMap(); dataNode.put("type", "photos"); dataNode.put("id", "1"); Map<String, Object> attributesNode = new HashMap(); attributesNode.put("url", "http: attributesNode.put("title", "My Photo"); attributesNode.put("color", "#EF5350"); attributesNode.put("shutter", 23.641); Map<String, Object> locationNode = new HashMap(); locationNode.put("latitude", 39.9042); locationNode.put("longitude", 116.4074); attributesNode.put("location", locationNode); dataNode.put("attributes", attributesNode); photoMap.put("data", dataNode); Document document = getDocumentAdapter(null, Photo.class).fromJsonValue(photoMap); Photo photo = (Photo) document.asObjectDocument().get(); assertEquals(new Double(23.641), photo.getShutter()); assertEquals(new Double(39.9042), photo.getLocation().latitude); }
public <DATA extends ResourceIdentifier> ObjectDocument<DATA> asObjectDocument() { return asObjectDocument(0); }
Document implements Serializable { public <DATA extends ResourceIdentifier> ObjectDocument<DATA> asObjectDocument() { return asObjectDocument(0); } }
Document implements Serializable { public <DATA extends ResourceIdentifier> ObjectDocument<DATA> asObjectDocument() { return asObjectDocument(0); } Document();  Document(Document document); }
Document implements Serializable { public <DATA extends ResourceIdentifier> ObjectDocument<DATA> asObjectDocument() { return asObjectDocument(0); } Document();  Document(Document document); @Deprecated boolean include(Resource resource); @Deprecated boolean exclude(Resource resource); boolean addInclude(Resource resource); Collection<Resource> getIncluded(); @SuppressWarnings({"SuspiciousMethodCalls", "unchecked"}) T find(ResourceIdentifier resourceIdentifier); T find(String type, String id); @Deprecated boolean errors(List<Error> errors); @Deprecated List<Error> errors(); boolean addError(Error error); boolean setErrors(Collection<Error> errors); List<Error> getErrors(); boolean hasError(); JsonBuffer getMeta(); void setMeta(JsonBuffer meta); JsonBuffer getLinks(); void setLinks(JsonBuffer links); JsonBuffer getJsonApi(); void setJsonApi(JsonBuffer jsonApi); @SuppressWarnings("unchecked") ArrayDocument<DATA> asArrayDocument(); ObjectDocument<DATA> asObjectDocument(); @SuppressWarnings("unchecked") ObjectDocument<DATA> asObjectDocument(int position); @Override boolean equals(Object o); @Override int hashCode(); }
Document implements Serializable { public <DATA extends ResourceIdentifier> ObjectDocument<DATA> asObjectDocument() { return asObjectDocument(0); } Document();  Document(Document document); @Deprecated boolean include(Resource resource); @Deprecated boolean exclude(Resource resource); boolean addInclude(Resource resource); Collection<Resource> getIncluded(); @SuppressWarnings({"SuspiciousMethodCalls", "unchecked"}) T find(ResourceIdentifier resourceIdentifier); T find(String type, String id); @Deprecated boolean errors(List<Error> errors); @Deprecated List<Error> errors(); boolean addError(Error error); boolean setErrors(Collection<Error> errors); List<Error> getErrors(); boolean hasError(); JsonBuffer getMeta(); void setMeta(JsonBuffer meta); JsonBuffer getLinks(); void setLinks(JsonBuffer links); JsonBuffer getJsonApi(); void setJsonApi(JsonBuffer jsonApi); @SuppressWarnings("unchecked") ArrayDocument<DATA> asArrayDocument(); ObjectDocument<DATA> asObjectDocument(); @SuppressWarnings("unchecked") ObjectDocument<DATA> asObjectDocument(int position); @Override boolean equals(Object o); @Override int hashCode();  }