Package org.bson

Class BsonArray

  • All Implemented Interfaces:
    , <<<BsonValue>
    Direct Known Subclasses:
    RawBsonArray

    public class BsonArray
    extends BsonValue
    implements <
    A type-safe representation of the BSON array type.
    Since:
    3.0
    • Constructor Detail

      • BsonArray

        public BsonArray​(<? extends BsonValue> values)
        Construct an instance with the given list of values.
        Parameters:
        values - the list of values, none of whose members may be null.
      • BsonArray

        public BsonArray()
        Construct an empty BsonArray
    • Method Detail

      • parse

        public static  json)
        Parses a string in MongoDB Extended JSON format to a BsonArray
        Parameters:
        json - the JSON string
        Returns:
        a corresponding BsonArray object
        Since:
        3.4
        See Also:
        JsonReader
        MongoDB documentation
      • getValues

        public <BsonValue> getValues()
        Gets the values in this array as a list of BsonValue objects.
        Returns:
        the values in this array.
      • getBsonType

        public BsonType getBsonType()
        Description copied from class: BsonValue
        Gets the BSON type of this value.
        Specified by:
        getBsonType in class BsonValue
        Returns:
        the BSON type, which may not be null (but may be BSONType.NULL)
      • size

        public int size()
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • isEmpty

        public boolean isEmpty()
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • contains

        public boolean contains​( o)
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • toArray

        public [] toArray()
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • toArray

        public <T> T[] toArray​(T[] a)
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • add

        public boolean add​(BsonValue bsonValue)
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • remove

        public boolean remove​( o)
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • containsAll

        public boolean containsAll​(<?> c)
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • addAll

        public boolean addAll​(<? extends BsonValue> c)
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • addAll

        public boolean addAll​(int index,
                              <? extends BsonValue> c)
        Specified by:
         in interface <BsonValue>
      • removeAll

        public boolean removeAll​(<?> c)
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • retainAll

        public boolean retainAll​(<?> c)
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • clear

        public void clear()
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
      • add

        public void add​(int index,
                        BsonValue element)
        Specified by:
         in interface <BsonValue>
      • remove

        public BsonValue remove​(int index)
        Specified by:
         in interface <BsonValue>
      • indexOf

        public int indexOf​( o)
        Specified by:
         in interface <BsonValue>
      • lastIndexOf

        public int lastIndexOf​( o)
        Specified by:
         in interface <BsonValue>
      • listIterator

        public <BsonValue> listIterator()
        Specified by:
         in interface <BsonValue>
      • listIterator

        public <BsonValue> listIterator​(int index)
        Specified by:
         in interface <BsonValue>
      • subList

        public <BsonValue> subList​(int fromIndex,
                                       int toIndex)
        Specified by:
         in interface <BsonValue>
      • equals

        public boolean equals​( o)
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
        Overrides:
         in class 
      • hashCode

        public int hashCode()
        Specified by:
         in interface <BsonValue>
        Specified by:
         in interface <BsonValue>
        Overrides:
         in class 
      • toString

        public  toString()
        Overrides:
         in class 
      • clone

        public BsonArray clone()
        Overrides:
         in class