public class IfxBSONObject extends com.informix.jdbc.IfxObject implements java.sql.SQLData, BSONObject
SQLData
interface necessary
to read and write BSON data with the Informix JDBC driver and the
BSONObject
interface necessary to work with BSON objects that
returned by or sent to Informix.
Note: This class is not thread safe.
Constructor and Description |
---|
IfxBSONObject()
A no-arg constructor is required for SQLData to work.
|
IfxBSONObject(BSONObject bsonObject)
Constructs a new object from the specified
BSONObject . |
IfxBSONObject(byte[] bytes)
Constructs a new object from the specified BSON-encoded byte array.
|
IfxBSONObject(byte[] bytes,
boolean copyBytes)
Constructs a new object from the specified BSON-encoded byte array.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the instance states
|
boolean |
containsField(java.lang.String s)
Checks if this object contains a field with the given name.
|
boolean |
containsKey(java.lang.String s)
Deprecated.
|
static IfxBSONObject |
ensureIfxBSONObject(java.lang.Object o)
Ensures that the specified object is an
IfxBSONObject . |
boolean |
equals(java.lang.Object o)
Find out whether two objects are equal.
|
void |
fromBytes(byte[] b) |
void |
fromIfx(byte[] b) |
void |
fromIfx(byte[] b,
int offset,
int blength) |
void |
fromInputStream(java.io.InputStream x,
int length) |
void |
fromObject(java.lang.Object data)
Initialize IfxObject with the value in obj.
|
java.lang.Object |
get(java.lang.String key)
Gets a field from this object by a given name.
|
byte[] |
getBytes() |
java.lang.String |
getSQLTypeName() |
int |
hashCode() |
java.util.Set<java.lang.String> |
keySet()
Returns this object's fields' names
|
java.lang.Object |
put(java.lang.String key,
java.lang.Object v)
Sets a name/value pair in this object.
|
void |
putAll(BSONObject o)
Sets all key/value pairs from an object into this object
|
void |
putAll(java.util.Map m)
Sets all key/value pairs from a map into this object
|
void |
readSQL(java.sql.SQLInput stream,
java.lang.String typeName) |
java.lang.Object |
removeField(java.lang.String key)
Removes a field with a given name from this object.
|
void |
setBSONObject(BSONObject bsonObject)
Assigns the BSONObject this object represents.
|
void |
setBytes(byte[] bytes)
Assigns the BSON-encoded byte array representation of a document.
|
void |
setConnection(com.informix.jdbc.IfxConnection conn)
GENERIC
|
java.io.InputStream |
toBinaryStream() |
byte[] |
toBytes() |
byte[] |
toIfx() |
byte[] |
toIfxTuple() |
java.util.Map<java.lang.String,java.lang.Object> |
toMap()
Returns a map representing this BSONObject.
|
java.lang.Object |
toObject() |
java.lang.Object |
toObject(boolean fromComplexType)
This version of toObject has a parameter that indicates if
we are doing a toObject for a complex type.
|
java.lang.String |
toString()
Convert to string.
|
void |
writeSQL(java.sql.SQLOutput stream) |
clearWarning, fromAsciiStream, fromAsciiStream, fromBinaryStream, fromBinaryStream, fromBlob, fromBoolean, fromBoolean, fromByte, fromByte, fromCharacterStream, fromCharacterStream, fromClob, fromDate, fromDecimal, fromDecimal, fromDouble, fromDouble, fromFloat, fromFloat, fromIfx, fromIfx, fromIfx, fromIfx, fromInputStream, fromInt, fromInt, fromIntervalDF, fromIntervalYM, fromLong, fromLong, fromObject, fromObject, fromShort, fromShort, fromString, fromString, fromTime, fromTimestamp, get_used_in_update, getEncodedLength, getWarning, isNull, nullify, set_used_in_update, setExtendedTypeName, setIfxType, setTypeMap, toAsciiStream, toBlob, toBoolean, toByte, toCharacterStream, toClob, toDate, toDecimal, toDouble, toFloat, toIfxBSONObject, toInputStream, toInt, toInterval, toIntervalDF, toIntervalYM, toLong, toShort, toTime, toTimestamp, toUnloadString, unnullify
public IfxBSONObject()
public IfxBSONObject(byte[] bytes)
bytes
- the BSON-encoded documentpublic IfxBSONObject(byte[] bytes, boolean copyBytes)
bytes
- the BSON-encoded documentcopyBytes
- if true
the byte array is copiedpublic IfxBSONObject(BSONObject bsonObject)
BSONObject
. It is
generally preferable to use the method
ensureIfxBSONObject(Object)
as it inspects the
object to see if it is already of type IfxBSONObject
.bsonObject
- public java.lang.String getSQLTypeName() throws java.sql.SQLException
getSQLTypeName
in interface java.sql.SQLData
java.sql.SQLException
public void readSQL(java.sql.SQLInput stream, java.lang.String typeName) throws java.sql.SQLException
readSQL
in interface java.sql.SQLData
java.sql.SQLException
public void writeSQL(java.sql.SQLOutput stream) throws java.sql.SQLException
writeSQL
in interface java.sql.SQLData
java.sql.SQLException
public byte[] getBytes()
public void setBytes(byte[] bytes)
null
.bytes
- the BSON-encoded byte array representation of a documentpublic void setBSONObject(BSONObject bsonObject)
null
.bsonObject
- the documentjava.lang.NullPointerException
- if the bsonObject is nullpublic static IfxBSONObject ensureIfxBSONObject(java.lang.Object o)
IfxBSONObject
. If the
object is already of type IfxBSONObject
, the object is simply
cast and returned. If the object implements the BSONObject
interface, the appropriate constructor is called and the new object is
returned.o
- java.lang.NullPointerException
- if the specified object is nulljava.lang.IllegalArgumentException
- if the object is not of type IfxBSONObject
and does
not implement the interface BSONObject
public java.lang.String toString()
com.informix.jdbc.IfxObject
public java.lang.Object put(java.lang.String key, java.lang.Object v)
BSONObject
put
in interface BSONObject
key
- Name to setv
- Corresponding valuepublic void putAll(BSONObject o)
BSONObject
putAll
in interface BSONObject
o
- the objectpublic void putAll(java.util.Map m)
BSONObject
putAll
in interface BSONObject
m
- the mappublic java.lang.Object get(java.lang.String key)
BSONObject
get
in interface BSONObject
key
- The name of the field fetchpublic java.util.Map<java.lang.String,java.lang.Object> toMap()
BSONObject
toMap
in interface BSONObject
public java.lang.Object removeField(java.lang.String key)
BSONObject
removeField
in interface BSONObject
key
- The name of the field to remove@Deprecated public boolean containsKey(java.lang.String s)
BSONObject
containsKey
in interface BSONObject
public boolean containsField(java.lang.String s)
BSONObject
containsField
in interface BSONObject
s
- Field name for which to checkpublic java.util.Set<java.lang.String> keySet()
BSONObject
keySet
in interface BSONObject
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
com.informix.jdbc.IfxObject
equals
in class com.informix.jdbc.IfxObject
o
- the other object to compare withpublic void fromObject(java.lang.Object data) throws java.sql.SQLException
com.informix.jdbc.IfxObject
fromObject
in class com.informix.jdbc.IfxObject
data
- Convert the data value from obj to IfxObjectjava.sql.SQLException
public java.lang.Object toObject() throws java.sql.SQLException
toObject
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public java.lang.Object toObject(boolean fromComplexType) throws java.sql.SQLException
toObject
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public void fromBytes(byte[] b) throws java.sql.SQLException
fromBytes
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public byte[] toBytes() throws java.sql.SQLException
toBytes
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public void fromInputStream(java.io.InputStream x, int length) throws java.sql.SQLException
fromInputStream
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public java.io.InputStream toBinaryStream() throws java.sql.SQLException
toBinaryStream
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public void clear()
com.informix.jdbc.IfxObject
clear
in class com.informix.jdbc.IfxObject
public void setConnection(com.informix.jdbc.IfxConnection conn) throws java.sql.SQLException
com.informix.jdbc.IfxObject
setConnection
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public void fromIfx(byte[] b) throws java.sql.SQLException
fromIfx
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public void fromIfx(byte[] b, int offset, int blength) throws java.sql.SQLException
fromIfx
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public byte[] toIfx() throws java.sql.SQLException
toIfx
in class com.informix.jdbc.IfxObject
java.sql.SQLException
public byte[] toIfxTuple() throws java.sql.SQLException
toIfxTuple
in class com.informix.jdbc.IfxObject
java.sql.SQLException