public class IfxBSONObject extends IfxObject implements java.sql.SQLData, org.bson.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.
| Modifier and Type | Field and Description |
|---|---|
protected org.bson.BSONObject |
bsonObject
The decoded BSON object.
|
protected byte[] |
bsonObjectBytes
Stores
BSONObject as a BSON-encoded representation of the byte
array. |
protected int |
bsonObjectHashCode
Stores the hashCode of the
bsonObject whenever it is assigned. |
protected IfxUDTInput |
inputStream |
protected IfxUDTOutput |
outputStream |
protected static int |
UDT_FLAG_SIZE |
protected static int |
UDT_LENGTH_SIZE |
conn, encodedLength, extendedID, extendedName, extendedOwner, ifxType, isNull, jdbcType, sourceType, trace, typeMap, used_in_update| Constructor and Description |
|---|
IfxBSONObject()
A no-arg constructor is required for SQLData to work.
|
IfxBSONObject(org.bson.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) |
boolean |
containsKey(java.lang.String s)
Deprecated.
|
protected void |
ensureBsonObject()
Ensures that the
bsonObject field is non-null. |
protected void |
ensureBsonObjectBytes()
Ensures that the
bsonObjectBytes field is non-null. |
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) |
byte[] |
getBytes() |
java.lang.String |
getSQLTypeName() |
int |
hashCode() |
java.util.Set<java.lang.String> |
keySet() |
java.lang.Object |
put(java.lang.String key,
java.lang.Object v) |
void |
putAll(org.bson.BSONObject o) |
void |
putAll(java.util.Map m) |
void |
readSQL(java.sql.SQLInput stream,
java.lang.String typeName) |
java.lang.Object |
removeField(java.lang.String key) |
void |
setBSONObject(org.bson.BSONObject bsonObject)
Assigns the BSONObject this object represents.
|
void |
setBytes(byte[] bytes)
Assigns the BSON-encoded byte array representation of a document.
|
void |
setConnection(IfxConnection conn)
GENERIC
|
java.io.InputStream |
toBinaryStream() |
byte[] |
toBytes() |
byte[] |
toIfx() |
byte[] |
toIfxTuple() |
java.util.Map<java.lang.String,java.lang.Object> |
toMap() |
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.
|
protected void |
unsafeSetBSONObject(org.bson.BSONObject bsonObject)
WARNING:This method should not be made public.
|
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, fromNClob, fromObject, fromObject, fromRowId, fromShort, fromShort, fromSQLXML, 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, toNClob, toRowId, toShort, toSQLXML, toTime, toTimestamp, toUnloadString, unnullifyprotected byte[] bsonObjectBytes
BSONObject as a BSON-encoded representation of the byte
array. At any given time either the bsonObject is null or the
bsonObjectBytes are null. At no time are both non-null.protected org.bson.BSONObject bsonObject
protected int bsonObjectHashCode
bsonObject whenever it is assigned.
When fetching the bytes, if the Object.hashCode() of the current
bsonObject does not match that saved when the bsonObject was
initially assigned, the bsonObjectBytes must be re-computed.protected static final int UDT_FLAG_SIZE
protected static final int UDT_LENGTH_SIZE
protected IfxUDTInput inputStream
protected IfxUDTOutput outputStream
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(org.bson.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.SQLDatajava.sql.SQLExceptionpublic void readSQL(java.sql.SQLInput stream,
java.lang.String typeName)
throws java.sql.SQLException
readSQL in interface java.sql.SQLDatajava.sql.SQLExceptionpublic void writeSQL(java.sql.SQLOutput stream)
throws java.sql.SQLException
writeSQL in interface java.sql.SQLDatajava.sql.SQLExceptionprotected void ensureBsonObjectBytes()
bsonObjectBytes field is non-null.protected void ensureBsonObject()
bsonObject field is non-null.public byte[] getBytes()
public void setBytes(byte[] bytes)
null.bytes - the BSON-encoded byte array representation of a documentpublic void setBSONObject(org.bson.BSONObject bsonObject)
null.bsonObject - the documentjava.lang.NullPointerException - if the bsonObject is nullprotected void unsafeSetBSONObject(org.bson.BSONObject bsonObject)
WARNING:This method should not be made public.
Assigns the bsonObject and bsonObjectHashCode fields.
If the bsonObject is null, the hash code is assigned the
value 0. No exception is thrown when a null bsonObject is
specified.
bsonObject - public 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 BSONObjectpublic java.lang.String toString()
IfxObjectpublic java.lang.Object put(java.lang.String key,
java.lang.Object v)
put in interface org.bson.BSONObjectpublic void putAll(org.bson.BSONObject o)
putAll in interface org.bson.BSONObjectpublic void putAll(java.util.Map m)
putAll in interface org.bson.BSONObjectpublic java.lang.Object get(java.lang.String key)
get in interface org.bson.BSONObjectpublic java.util.Map<java.lang.String,java.lang.Object> toMap()
toMap in interface org.bson.BSONObjectpublic java.lang.Object removeField(java.lang.String key)
removeField in interface org.bson.BSONObject@Deprecated public boolean containsKey(java.lang.String s)
containsKey in interface org.bson.BSONObjectpublic boolean containsField(java.lang.String s)
containsField in interface org.bson.BSONObjectpublic java.util.Set<java.lang.String> keySet()
keySet in interface org.bson.BSONObjectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
IfxObjectpublic void fromObject(java.lang.Object data)
throws java.sql.SQLException
IfxObjectfromObject in class IfxObjectdata - Convert the data value from obj to IfxObjectjava.sql.SQLExceptionpublic java.lang.Object toObject()
throws java.sql.SQLException
public java.lang.Object toObject(boolean fromComplexType)
throws java.sql.SQLException
public void fromBytes(byte[] b)
throws java.sql.SQLException
public byte[] toBytes()
throws java.sql.SQLException
public void fromInputStream(java.io.InputStream x,
int length)
throws java.sql.SQLException
fromInputStream in class IfxObjectjava.sql.SQLExceptionpublic java.io.InputStream toBinaryStream()
throws java.sql.SQLException
toBinaryStream in class IfxObjectjava.sql.SQLExceptionpublic void clear()
IfxObjectpublic void setConnection(IfxConnection conn) throws java.sql.SQLException
IfxObjectsetConnection in class IfxObjectjava.sql.SQLExceptionpublic void fromIfx(byte[] b)
throws java.sql.SQLException
public void fromIfx(byte[] b,
int offset,
int blength)
throws java.sql.SQLException
public byte[] toIfx()
throws java.sql.SQLException
public byte[] toIfxTuple()
throws java.sql.SQLException
toIfxTuple in class IfxObjectjava.sql.SQLException