public interface DocumentRecord
JSONDocumentManager docMgr = databaseClient.newJSONDocumentManager();
docMgr.setNonDocumentFormat(Format.XML);
docMgr.setMetadataCategories(Metadata.COLLECTIONS);
DocumentPage documents = docMgr.read("doc1.json", "doc2.json");
try {
for ( DocumentRecord record : documents ) {
String uri = record.getUri();
JacksonHandle content = record.getContent(new JacksonHandle());
DocumentMetadataHandle metadata = record.getMetadata(new DocumentMetadataHandle());
DocumentCollections collections = metadata.getCollections();
// ... do something ...
}
} finally {
documents.close();
}
Modifier and Type | Method and Description |
---|---|
<T extends AbstractReadHandle> |
getContent(T contentHandle)
Given a handle, populates the handle with the document contents directly from
the server (or the transformed contents if a ServerTransform was used).
|
<T> T |
getContentAs(Class<T> as)
Reads the document content from the multipart response into the representation
specified by the IO class.
|
Format |
getFormat()
Returns the format of the document in the server
|
<T extends DocumentMetadataReadHandle> |
getMetadata(T metadataHandle)
Given a handle, populates the handle with the structured metadata directly from
the REST API.
|
<T> T |
getMetadataAs(Class<T> as)
Reads the metadata from the multipart response into the representation
specified by the IO class.
|
String |
getMimetype()
Returns the mime-type ("Content-Type" header) of the document as specified by
the server (uses the server's mime-type mapping for file extensions)
|
String |
getUri()
Returns the uri (unique identifier) of the document in the server
|
String getUri()
Format getFormat()
String getMimetype()
<T extends DocumentMetadataReadHandle> T getMetadata(T metadataHandle)
T
- the type of DocumentMetadataReadHandle to returnmetadataHandle
- the handle to populate with the metadata<T> T getMetadataAs(Class<T> as)
ContentHandle
are registered.
Learn more about shortcut methodsT
- the type of object that will be returned by the handle registered for itas
- the Class which a handle should instantiate, populate and return<T extends AbstractReadHandle> T getContent(T contentHandle)
format
of this document.T
- the type of AbstractReadHandle to returncontentHandle
- the handle to populate with the contents<T> T getContentAs(Class<T> as)
ContentHandle
are registered.
Learn more about shortcut methodsT
- the type of object that will be returned by the handle registered for itas
- the Class which a handle should instantiate, populate and returnCopyright © 2013-2016 MarkLogic Corporation.