Package oracle.soda
Interface OracleDocumentFactory
-
- All Known Subinterfaces:
OracleDatabase
public interface OracleDocumentFactory
A factory for creatingOracleDocument
objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OracleDocument
createDocumentFrom(Object content)
Creates a new document with the provided key and provided JSONcontent
object.OracleDocument
createDocumentFrom(String key, Object content)
Creates a new document with the provided key and JSONcontent
object.OracleDocument
createDocumentFromByteArray(byte[] content)
Creates a new document with the providedbyte[]
JSON content.OracleDocument
createDocumentFromByteArray(String key, byte[] content)
Creates a new document with the provided key andbyte[]
JSON content.OracleDocument
createDocumentFromByteArray(String key, byte[] content, String mediaType)
Creates a new document with the provided key,byte[]
content, and content type.OracleDocument
createDocumentFromString(String content)
Creates a new document with the providedString
JSON content.OracleDocument
createDocumentFromString(String key, String content)
Creates a new document with the provided key andString
JSON content.OracleDocument
createDocumentFromString(String key, String content, String mediaType)
Creates a new document with the provided key,String
content, and media type.
-
-
-
Method Detail
-
createDocumentFromString
OracleDocument createDocumentFromString(String content) throws OracleException
Creates a new document with the providedString
JSON content.This method is equivalent to invoking
createDocumentFromString(null, content, null)
- Parameters:
content
- document content. Can benull
- Returns:
- created
OracleDocument
, with media type"application/json"
- Throws:
OracleException
- if the document cannot be created- See Also:
createDocumentFromString(String, String, String)
,createDocumentFromString(String, String)
-
createDocumentFromString
OracleDocument createDocumentFromString(String key, String content) throws OracleException
Creates a new document with the provided key andString
JSON content.This method is equivalent to invoking
createDocumentFromString(key, content, null)
- Parameters:
key
- document key. Can benull
content
- document content. Can benull
- Returns:
- created
OracleDocument
, with media type"application/json"
- Throws:
OracleException
- if the document cannot be created- See Also:
createDocumentFromString(String, String, String)
,createDocumentFromString(String)
-
createDocumentFromString
OracleDocument createDocumentFromString(String key, String content, String mediaType) throws OracleException
Creates a new document with the provided key,String
content, and media type.If the media type is
"application/json"
ornull
, the providedcontent
must be JSON, as defined in RFC 4627.- Parameters:
key
- document key. Can benull
content
- document content. Can benull
mediaType
- document media type. Can benull
, in which case the media type defaults to"application/json"
. An implementation might not support any particular media type- Returns:
- created
OracleDocument
- Throws:
OracleException
- if the document cannot be created
-
createDocumentFrom
OracleDocument createDocumentFrom(Object content) throws OracleException
Creates a new document with the provided key and provided JSONcontent
object.This method is equivalent to invoking
createDocumentFrom(null, content)
- Parameters:
content
- document content. Must not benull
- Returns:
- created
OracleDocument
, with media type"application/json"
- Throws:
OracleException
- if the document cannot be created from the specified value- See Also:
createDocumentFrom(String, Object)
-
createDocumentFrom
OracleDocument createDocumentFrom(String key, Object content) throws OracleException
Creates a new document with the provided key and JSONcontent
object. The content object must be an instance of one of the following types:
Class Description javax.json.JsonValue
jakarta.json.JsonValue
oracle.sql.json.OracleJsonValue
A instance of JsonValue
orOracleJsonValue
. This includes derivations such asJsonObject
andJsonArray
. For example:JsonBuilderFactory factory = Json.createBuilderFactory(null); JsonObject obj = factory.createObjectBuilder() .add("name", "pear") .add("count", 47) .build(); OracleDocument doc = db.createDocumentFrom(obj);
javax.json.stream.JsonParser
jakarta.json.stream.JsonParser
oracle.sql.json.OracleJsonParser
A JSON event stream. java.lang.String
java.lang.CharSequence
java.io.Reader
A JSON text value. javax.json
will be removed in an upcoming release.- Parameters:
key
- document key. Can benull
content
- document content. Must not benull
- Returns:
- created
OracleDocument
, with media type"application/json"
- Throws:
OracleException
- if the document cannot be created from the specified value.- See Also:
- Java API for JSON Processing
-
createDocumentFromByteArray
OracleDocument createDocumentFromByteArray(byte[] content) throws OracleException
Creates a new document with the providedbyte[]
JSON content.This method is equivalent to invoking
createDocumentFromByteArray(null, content, null)
- Parameters:
content
- document content. Can benull
- Returns:
- created
OracleDocument
, with media type"application/json"
- Throws:
OracleException
- if the document cannot be created- See Also:
createDocumentFromByteArray(String, byte[], String)
,createDocumentFromByteArray(String, byte[])
-
createDocumentFromByteArray
OracleDocument createDocumentFromByteArray(String key, byte[] content) throws OracleException
Creates a new document with the provided key andbyte[]
JSON content.This method is equivalent to invoking
createDocumentFromByteArray(key, content, null)
- Parameters:
key
- document key. Can benull
content
- document content. Can benull
- Returns:
- created
OracleDocument
, with media type"application/json"
- Throws:
OracleException
- if the document cannot be created- See Also:
createDocumentFromByteArray(String, byte[], String)
,createDocumentFromByteArray(byte[])
-
createDocumentFromByteArray
OracleDocument createDocumentFromByteArray(String key, byte[] content, String mediaType) throws OracleException
Creates a new document with the provided key,byte[]
content, and content type.If the media type is
"application/json"
ornull
, the providedcontent
must be JSON, as defined in RFC 4627. The supported encodings are UTF-8, and UTF16 (BE and LE).- Parameters:
key
- document key. Can benull
content
- document content. Can benull
mediaType
- document media type. Can benull
, in which case the media type defaults to"application/json"
. An implementation might not support any particular media type- Returns:
- created
OracleDocument
- Throws:
OracleException
- if the document cannot be created
-
-