Package org.bson

Class LazyBSONCallback

  • All Implemented Interfaces:
    BSONCallback

    public class LazyBSONCallback
    extends EmptyBSONCallback
    A BSONCallback for creation of LazyBSONObject and LazyBSONList instances.
    • Constructor Detail

      • LazyBSONCallback

        public LazyBSONCallback()
    • Method Detail

      • gotBinary

        public void gotBinary​(String name,
                              byte type,
                              byte[] data)
        Description copied from interface: BSONCallback
        Called when reading a field with a BsonType.BINARY value. Note that binary values have a subtype, which may determine how the value is processed.
        Specified by:
        gotBinary in interface BSONCallback
        Overrides:
        gotBinary in class EmptyBSONCallback
        Parameters:
        name - the name of the field
        type - one of the binary subtypes: BsonBinarySubType
        data - the field's value
      • createObject

        public Object createObject​(byte[] bytes,
                                   int offset)
        Create a LazyBSONObject instance from the given bytes starting from the given offset.
        Parameters:
        bytes - the raw BSON bytes
        offset - the offset into the bytes
        Returns:
        the LazyBSONObject
      • createArray

        public List createArray​(byte[] bytes,
                                int offset)
        Create a LazyBSONList from the given bytes starting from the given offset.
        Parameters:
        bytes - the raw BSON bytes
        offset - the offset into the bytes
        Returns:
        the LazyBSONList
      • createDBRef

        public Object createDBRef​(String ns,
                                  ObjectId id)
        This is a factory method pattern to create appropriate objects for BSON type DBPointer(0x0c).
        Parameters:
        ns - the namespace of the reference
        id - the identifier of the reference
        Returns:
        object to be used as reference representation