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<java.lang.String,java.lang.Object> 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, unnullifypublic 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.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.SQLExceptionpublic 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 BSONObjectpublic java.lang.String toString()
com.informix.jdbc.IfxObjectpublic java.lang.Object put(java.lang.String key,
java.lang.Object v)
BSONObjectput in interface BSONObjectkey - Name to setv - Corresponding valuepublic void putAll(BSONObject o)
BSONObjectputAll in interface BSONObjecto - the objectpublic void putAll(java.util.Map<java.lang.String,java.lang.Object> m)
BSONObjectputAll in interface BSONObjectm - the mappublic java.lang.Object get(java.lang.String key)
BSONObjectget in interface BSONObjectkey - The name of the field fetchpublic java.util.Map<java.lang.String,java.lang.Object> toMap()
BSONObjecttoMap in interface BSONObjectpublic java.lang.Object removeField(java.lang.String key)
BSONObjectremoveField in interface BSONObjectkey - The name of the field to remove@Deprecated public boolean containsKey(java.lang.String s)
BSONObjectcontainsKey in interface BSONObjectpublic boolean containsField(java.lang.String s)
BSONObjectcontainsField in interface BSONObjects - Field name for which to checkpublic java.util.Set<java.lang.String> keySet()
BSONObjectkeySet in interface BSONObjectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
com.informix.jdbc.IfxObjectequals in class com.informix.jdbc.IfxObjecto - the other object to compare withpublic void fromObject(java.lang.Object data)
throws java.sql.SQLException
com.informix.jdbc.IfxObjectfromObject in class com.informix.jdbc.IfxObjectdata - Convert the data value from obj to IfxObjectjava.sql.SQLExceptionpublic java.lang.Object toObject()
throws java.sql.SQLException
toObject in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic java.lang.Object toObject(boolean fromComplexType)
throws java.sql.SQLException
toObject in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic void fromBytes(byte[] b)
throws java.sql.SQLException
fromBytes in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic byte[] toBytes()
throws java.sql.SQLException
toBytes in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic void fromInputStream(java.io.InputStream x,
int length)
throws java.sql.SQLException
fromInputStream in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic java.io.InputStream toBinaryStream()
throws java.sql.SQLException
toBinaryStream in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic void clear()
com.informix.jdbc.IfxObjectclear in class com.informix.jdbc.IfxObjectpublic void setConnection(com.informix.jdbc.IfxConnection conn)
throws java.sql.SQLException
com.informix.jdbc.IfxObjectsetConnection in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic void fromIfx(byte[] b)
throws java.sql.SQLException
fromIfx in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic void fromIfx(byte[] b,
int offset,
int blength)
throws java.sql.SQLException
fromIfx in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic byte[] toIfx()
throws java.sql.SQLException
toIfx in class com.informix.jdbc.IfxObjectjava.sql.SQLExceptionpublic byte[] toIfxTuple()
throws java.sql.SQLException
toIfxTuple in class com.informix.jdbc.IfxObjectjava.sql.SQLException