com.informix.jdbc.types.bson

Interface DBBson

  • All Superinterfaces:
    org.bson.BSONObject, java.util.Map<java.lang.String,java.lang.Object>, java.sql.SQLData


    public interface DBBson
    extends java.sql.SQLData, org.bson.BSONObject, java.util.Map<java.lang.String,java.lang.Object>
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K,V>
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      DBBson append(java.lang.String key, java.lang.Object value)
      Append the key/value pair to this document Similar to {BSONObject.put(String, Object) but this method returns the class reference to make multiple appends easier to write
      boolean containsField(java.lang.String s) 
      boolean containsKey(java.lang.String s) 
      void ensureRawDocument() 
      byte[] getBytes() 
      org.bson.Document getDocument()
      Return the Map version of the Bson document This version takes more memory but is completely manipulatable as you would a Map This returns a reference to the document object contained in this object.
      org.bson.Document getDocument(boolean recursive)
      Return the Map version of the Bson document This version takes more memory but is completely manipulatable as you would a Map This returns a reference to the document object contained in this object.
      DBBson getDocument(java.lang.String key)
      Returns a subdocument from this document
      double getDouble(java.lang.String key)
      Returns the double value of the key in the document
      java.lang.String getFirstKey()
      Return the first key from the document
      int getInt(java.lang.String key)
      Returns the int value of the key in the document
      org.bson.json.JsonMode getJsonFormat() 
      long getLong(java.lang.String key)
      Returns the long value of the key in the document
      org.bson.RawBsonDocument getRawDocument()
      Return the reference to the raw document If you get this object, this is a reference only, if you decided to modify this object later or the raw document take care as they can become out of sync.
      java.lang.String getString(java.lang.String key)
      Returns the string value of the key in the document
      boolean isRawDocument()
      Returns whether we are currently a raw document or a fully exploded java map
      void putAll(org.bson.BSONObject o) 
      java.lang.Object removeField(java.lang.String key) 
      void setBSONObject(org.bson.BSONObject bsonObject) 
      void setBytes(byte[] bytes)
      Assigns the BSON-encoded byte array representation of a document.
      void setDocument(org.bson.Document bsonObject)
      Assigns the BSONObject this object represents.
      DBBson setJsonFormat(org.bson.json.JsonMode mode) 
      void setRawDocument(org.bson.RawBsonDocument doc) 
      java.lang.String toJson()
      Returns a compact form of JSON Does not have a pretty-print or any extraneous whitespace
      java.util.Map<java.lang.String,java.lang.Object> toMap() 
      • Methods inherited from interface java.sql.SQLData

        getSQLTypeName, readSQL, writeSQL
      • Methods inherited from interface org.bson.BSONObject

        get, keySet, put, putAll
      • Methods inherited from interface java.util.Map

        clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
    • Method Detail

      • ensureRawDocument

        void ensureRawDocument()
      • getBytes

        byte[] getBytes()
      • setBytes

        void setBytes(byte[] bytes)
        Assigns the BSON-encoded byte array representation of a document. The bsonObject representation is assigned the value null.
        Parameters:
        bytes - the BSON-encoded byte array representation of a document
      • setRawDocument

        void setRawDocument(org.bson.RawBsonDocument doc)
      • setDocument

        void setDocument(org.bson.Document bsonObject)
        Assigns the BSONObject this object represents. The BSON-encoded byte array representation is assigned the value null.
        Parameters:
        bsonObject - the document
        Throws:
        java.lang.NullPointerException - if the bsonObject is null
      • setBSONObject

        void setBSONObject(org.bson.BSONObject bsonObject)
      • toJson

        java.lang.String toJson()
        Returns a compact form of JSON Does not have a pretty-print or any extraneous whitespace
        Returns:
        String a compact JSON representation of this document
      • toMap

        java.util.Map<java.lang.String,java.lang.Object> toMap()
        Specified by:
        toMap in interface org.bson.BSONObject
      • containsKey

        boolean containsKey(java.lang.String s)
        Specified by:
        containsKey in interface org.bson.BSONObject
      • containsField

        boolean containsField(java.lang.String s)
        Specified by:
        containsField in interface org.bson.BSONObject
      • getDocument

        org.bson.Document getDocument()
        Return the Map version of the Bson document This version takes more memory but is completely manipulatable as you would a Map This returns a reference to the document object contained in this object. If you manipulate this document outside of the object you might need to create a new IfxBSONOBject
        Returns:
        Document this
      • getDocument

        org.bson.Document getDocument(boolean recursive)
        Return the Map version of the Bson document This version takes more memory but is completely manipulatable as you would a Map This returns a reference to the document object contained in this object. If you manipulate this document outside of the object you might need to create a new IfxBSONOBject
        Parameters:
        recursive - boolean indicating whether it should recursively turn any sub-doucments into maps as well
        Returns:
        Document this
      • getDocument

        DBBson getDocument(java.lang.String key)
        Returns a subdocument from this document
        Parameters:
        key - field to search for
        Returns:
        IfxBSONObject the resulting document
      • getRawDocument

        org.bson.RawBsonDocument getRawDocument()
        Return the reference to the raw document If you get this object, this is a reference only, if you decided to modify this object later or the raw document take care as they can become out of sync. The best practice is to create a new IfxBSONObject later if you modify the raw document outside of this class
        Returns:
        RawBsonDocument Raw document underlying object
      • append

        DBBson append(java.lang.String key,
                      java.lang.Object value)
        Append the key/value pair to this document Similar to {BSONObject.put(String, Object) but this method returns the class reference to make multiple appends easier to write
        Parameters:
        key - Key to set
        value - Object to set
        Returns:
        IfxBSONObject this object
      • getInt

        int getInt(java.lang.String key)
        Returns the int value of the key in the document
        Parameters:
        key - Key to lookup
        Returns:
        int the value of the key
      • getLong

        long getLong(java.lang.String key)
        Returns the long value of the key in the document
        Parameters:
        key - Key to lookup
        Returns:
        long the value of the key
      • getDouble

        double getDouble(java.lang.String key)
        Returns the double value of the key in the document
        Parameters:
        key - Key to lookup
        Returns:
        double the value of the key
      • getString

        java.lang.String getString(java.lang.String key)
        Returns the string value of the key in the document
        Parameters:
        key - Key to lookup
        Returns:
        string the value of the key
      • isRawDocument

        boolean isRawDocument()
        Returns whether we are currently a raw document or a fully exploded java map
        Returns:
        boolean true if we are are a raw document
      • getFirstKey

        java.lang.String getFirstKey()
        Return the first key from the document
        Returns:
        String the first key in the document
      • putAll

        void putAll(org.bson.BSONObject o)
        Specified by:
        putAll in interface org.bson.BSONObject
      • removeField

        java.lang.Object removeField(java.lang.String key)
        Specified by:
        removeField in interface org.bson.BSONObject
      • setJsonFormat

        DBBson setJsonFormat(org.bson.json.JsonMode mode)
      • getJsonFormat

        org.bson.json.JsonMode getJsonFormat()