public interface OracleDocument
The content can also be another MIME type: image, audio, video, etc.
The document has the following components:
It is valid for any of the above components to be missing in
a given OracleDocument
.
Some examples:
OracleCollection.insert(OracleDocument)
and
OracleCollection.insertAndGet(OracleDocument)
input documents may contain content only.
Key is automatically generated by the insert operation.
If the collection is configured with client-assigned keys,
the input document needs to contain the key as well.
OracleCursor
obtained by calling
col.find().getCursor()
may contain key, content, created-on
timestamp, last-modified timestamp, and version.
OracleCollection.insertAndGet(OracleDocument)
or OracleOperationBuilder.replaceOneAndGet(OracleDocument)
may contain key, created-on timestamp, last-modified timestamp,
and version. These documents will not have any content.
Modifier and Type | Method and Description |
---|---|
<T> T |
getContentAs(java.lang.Class<T> type)
Returns the content as the specified type.
|
byte[] |
getContentAsByteArray()
Returns the content as a byte array.
|
java.lang.String |
getContentAsString()
Returns the content as a
String . |
int |
getContentLength()
Returns the length of content if know.
|
java.lang.String |
getCreatedOn()
Returns the timestamp of creation of this document in ISO format.
|
java.lang.String |
getKey()
Returns the key.
|
java.lang.String |
getLastModified()
Returns the timestamp of the last modification to this document in
ISO format.
|
java.lang.String |
getMediaType()
Returns the media type.
|
java.lang.String |
getVersion()
Returns a string suitable for use as a version of the
document.
|
boolean |
isJSON()
Returns
true is this document has media type
"application/json" . |
java.lang.String getKey()
String
.
null
if the key is not
availablebyte[] getContentAsByteArray() throws OracleException
byte[]
,
or null
if the content is
not available.OracleException
- if there's an error returning content
as byte[]
java.lang.String getContentAsString() throws OracleException
String
.String
,
or null
if the content is not
availableOracleException
- if there's an error returning content
as String
<T> T getContentAs(java.lang.Class<T> type) throws OracleException
Class | Description |
---|---|
javax.json.JsonValue oracle.sql.json.OracleJsonValue
|
The JSON type value is returned as JsonValue or OracleJsonValue .
Any derived interface, such as JsonObject may also be used.
|
javax.json.stream.JsonParser oracle.sql.json.OracleJsonParser
|
The JSON type value is returned as an event stream. |
java.lang.String java.io.Reader
|
The JSON type value is returned as JSON text. |
T
- the type of the returned contenttype
- the type of the returned contentnull
if the content is not
availableOracleException
- if there's an error returning content
as the specified type or if a mapping to the
specified type is not supportedjava.lang.String getMediaType()
"application/json"
.String
,
or null
if the media type is
not availablejava.lang.String getLastModified()
String
representation of the
timestamp, or null
if the timestamp
is not availablejava.lang.String getCreatedOn()
String
representation of the
timestamp, or null
if the timestamp
is not availablejava.lang.String getVersion()
String
representation of the
version, or null
if the version
is not availableint getContentLength()
-1
is not known.-1
if not known.boolean isJSON()
true
is this document has media type
"application/json"
.true
if this document has
media type "application/json", false
otherwise