Package org.bson

Class EmptyBSONCallback

  • All Implemented Interfaces:
    BSONCallback
    Direct Known Subclasses:
    LazyBSONCallback


    public class EmptyBSONCallback
    extends Object
    implements BSONCallback
    Convenience implementation of BSONCallback that throws UnsupportedOperationException for all methods.
    • Constructor Detail

      • EmptyBSONCallback

        public EmptyBSONCallback​()
    • Method Detail

      • objectStart

        public void objectStart​()
        Description copied from interface: BSONCallback
        Signals the start of a BSON document, which usually maps onto some Java object.
        Specified by:
        objectStart in interface BSONCallback
      • objectStart

        public void objectStart​(String name)
        Description copied from interface: BSONCallback
        Signals the start of a BSON document, which usually maps onto some Java object.
        Specified by:
        objectStart in interface BSONCallback
        Parameters:
        name - the field name of the document.
      • objectDone

        public Object objectDone​()
        Description copied from interface: BSONCallback
        Called at the end of the document/array, and returns this object.
        Specified by:
        objectDone in interface BSONCallback
        Returns:
        the Object that has been read from this section of the document.
      • reset

        public void reset​()
        Description copied from interface: BSONCallback
        Resets the callback, clearing all state.
        Specified by:
        reset in interface BSONCallback
      • get

        public Object get​()
        Description copied from interface: BSONCallback
        Returns the finished top-level Document.
        Specified by:
        get in interface BSONCallback
        Returns:
        the top level document read from the database.
      • arrayStart

        public void arrayStart​()
        Description copied from interface: BSONCallback
        Signals the start of a BSON array.
        Specified by:
        arrayStart in interface BSONCallback
      • arrayStart

        public void arrayStart​(String name)
        Description copied from interface: BSONCallback
        Signals the start of a BSON array, with its field name.
        Specified by:
        arrayStart in interface BSONCallback
        Parameters:
        name - the name of this array field
      • arrayDone

        public Object arrayDone​()
        Description copied from interface: BSONCallback
        Called the end of the array, and returns the completed array.
        Specified by:
        arrayDone in interface BSONCallback
        Returns:
        an Object representing the array that has been read from this section of the document.
      • gotNull

        public void gotNull​(String name)
        Description copied from interface: BSONCallback
        Called when reading a BSON field that exists but has a null value.
        Specified by:
        gotNull in interface BSONCallback
        Parameters:
        name - the name of the field
        See Also:
        BsonType.NULL
      • gotBoolean

        public void gotBoolean​(String name,
                               boolean value)
        Description copied from interface: BSONCallback
        Called when reading a field with a BsonType.BOOLEAN value.
        Specified by:
        gotBoolean in interface BSONCallback
        Parameters:
        name - the name of the field
        value - the field's value
      • gotDouble

        public void gotDouble​(String name,
                              double value)
        Description copied from interface: BSONCallback
        Called when reading a field with a BsonType.DOUBLE value.
        Specified by:
        gotDouble in interface BSONCallback
        Parameters:
        name - the name of the field
        value - the field's value
      • gotInt

        public void gotInt​(String name,
                           int value)
        Description copied from interface: BSONCallback
        Called when reading a field with a BsonType.INT32 value.
        Specified by:
        gotInt in interface BSONCallback
        Parameters:
        name - the name of the field
        value - the field's value
      • gotLong

        public void gotLong​(String name,
                            long value)
        Description copied from interface: BSONCallback
        Called when reading a field with a BsonType.INT64 value.
        Specified by:
        gotLong in interface BSONCallback
        Parameters:
        name - the name of the field
        value - the field's value
      • gotDate

        public void gotDate​(String name,
                            long millis)
        Description copied from interface: BSONCallback
        Called when reading a field with a BsonType.DATE_TIME value.
        Specified by:
        gotDate in interface BSONCallback
        Parameters:
        name - the name of the field
        millis - the date and time in milliseconds
      • gotTimestamp

        public void gotTimestamp​(String name,
                                 int time,
                                 int increment)
        Description copied from interface: BSONCallback
        Called when reading a field with a BsonType.TIMESTAMP value.
        Specified by:
        gotTimestamp in interface BSONCallback
        Parameters:
        name - the name of the field
        time - the time in seconds since epoch
        increment - an incrementing ordinal for operations within a given second
      • gotDBRef

        public void gotDBRef​(String name,
                             String namespace,
                             ObjectId id)
        Description copied from interface: BSONCallback
        Invoked when BSONDecoder encountered a BsonType.DB_POINTER type field in a byte sequence.
        Specified by:
        gotDBRef in interface BSONCallback
        Parameters:
        name - the name of the field
        namespace - the namespace to which reference is pointing to
        id - the if of the object to which reference is pointing to
      • gotBinaryArray

        @Deprecated
        public void gotBinaryArray​(String name,
                                   byte[] data)
        Deprecated. 
        Description copied from interface: BSONCallback
        This method is not used.
        Specified by:
        gotBinaryArray in interface BSONCallback
        Parameters:
        name - the name of the field
        data - the field's value
      • 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
        Parameters:
        name - the name of the field
        type - one of the binary subtypes: BsonBinarySubType
        data - the field's value
      • gotUUID

        public void gotUUID​(String name,
                            long part1,
                            long part2)
        Description copied from interface: BSONCallback
        Called when reading a field with a UUID value. This is a binary value of subtype BsonBinarySubType.UUID_LEGACY
        Specified by:
        gotUUID in interface BSONCallback
        Parameters:
        name - the name of the field
        part1 - the first part of the UUID
        part2 - the second part of the UUID