Package oracle.soda
Interface OracleDocumentFactory
-
- All Known Subinterfaces:
OracleDatabase
public interface OracleDocumentFactoryA factory for creatingOracleDocumentobjects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OracleDocumentcreateDocumentFrom(Object content)Creates a new document with the provided key and provided JSONcontentobject.OracleDocumentcreateDocumentFrom(String key, Object content)Creates a new document with the provided key and JSONcontentobject.OracleDocumentcreateDocumentFromByteArray(byte[] content)Creates a new document with the providedbyte[]JSON content.OracleDocumentcreateDocumentFromByteArray(String key, byte[] content)Creates a new document with the provided key andbyte[]JSON content.OracleDocumentcreateDocumentFromByteArray(String key, byte[] content, String mediaType)Creates a new document with the provided key,byte[]content, and content type.OracleDocumentcreateDocumentFromString(String content)Creates a new document with the providedStringJSON content.OracleDocumentcreateDocumentFromString(String key, String content)Creates a new document with the provided key andStringJSON content.OracleDocumentcreateDocumentFromString(String key, String content, String mediaType)Creates a new document with the provided key,Stringcontent, and media type.
-
-
-
Method Detail
-
createDocumentFromString
OracleDocument createDocumentFromString(String content) throws OracleException
Creates a new document with the providedStringJSON 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 andStringJSON content.This method is equivalent to invoking
createDocumentFromString(key, content, null)- Parameters:
key- document key. Can benullcontent- 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,Stringcontent, and media type.If the media type is
"application/json"ornull, the providedcontentmust be JSON, as defined in RFC 4627.- Parameters:
key- document key. Can benullcontent- document content. Can benullmediaType- 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 JSONcontentobject.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 JSONcontentobject. The content object must be an instance of one of the following types:
Deprecation Notice: support forClass Description javax.json.JsonValue
jakarta.json.JsonValue
oracle.sql.json.OracleJsonValueA instance of JsonValueorOracleJsonValue. This includes derivations such asJsonObjectandJsonArray. 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.OracleJsonParserA JSON event stream. java.lang.String
java.lang.CharSequence
java.io.Reader
A JSON text value. javax.jsonwill be removed in an upcoming release.- Parameters:
key- document key. Can benullcontent- 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 benullcontent- 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 providedcontentmust be JSON, as defined in RFC 4627. The supported encodings are UTF-8, and UTF16 (BE and LE).- Parameters:
key- document key. Can benullcontent- document content. Can benullmediaType- 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
-
-