Class BasicDocument

    • Constructor Detail

      • BasicDocument

        BasicDocument()
    • Method Detail

      • size

        public int size()
        Description copied from interface: Document
        Return the number of name-value fields in this object.
        Specified by:
        size in interface Document
        Returns:
        the number of name-value fields; never negative
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: Document
        Return whether this document contains no fields and is therefore empty.
        Specified by:
        isEmpty in interface Document
        Returns:
        true if there are no fields in this document, or false if there is at least one.
      • compareTo

        public int compareTo​(Document that)
        Description copied from interface: Document
        Compare this Document to the specified Document, taking into account the order of the fields.
        Specified by:
        compareTo in interface Comparable<Document>
        Specified by:
        compareTo in interface Document
        Parameters:
        that - the other Document to be compared to this object
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      • compareToUsingSimilarFields

        public int compareToUsingSimilarFields​(Document that)
        Description copied from interface: Document
        Compare this Document to the specified Document, without regard to the order of the fields and only using the fields that are in both documents.
        Specified by:
        compareToUsingSimilarFields in interface Document
        Parameters:
        that - the other Document to be compared to this object
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      • compareToWithoutFieldOrder

        public int compareToWithoutFieldOrder​(Document that)
        Description copied from interface: Document
        Compare this Document to the specified Document, without regard to the order of the fields.
        Specified by:
        compareToWithoutFieldOrder in interface Document
        Parameters:
        that - the other Document to be compared to this object
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      • compareTo

        public int compareTo​(Document that,
                             boolean enforceFieldOrder)
        Description copied from interface: Document
        Compare this Document to the specified Document, optionally comparing the fields in the same order.
        Specified by:
        compareTo in interface Document
        Parameters:
        that - the other Document to be compared to this object
        enforceFieldOrder - true if the documents should be compared using their existing field order, or false if the field order should not affect the result.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      • compare

        protected int compare​(Value value1,
                              Value value2)
        Semantically compare two values. This includes comparing numeric values of different types (e.g., an integer and long), and null and Value.nullValue() references.
        Parameters:
        value1 - the first value; may be null
        value2 - the second value; may be null
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      • compareNonNull

        protected int compareNonNull​(Value value1,
                                     Value value2)
        Semantically compare two non-null values. This includes comparing numeric values of different types (e.g., an integer and long), but excludes null and Value.nullValue() references.
        Parameters:
        value1 - the first value; may be null
        value2 - the second value; may be null
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      • keySet

        public Iterable<CharSequence> keySet()
        Description copied from interface: Document
        Returns this object's fields' names
        Specified by:
        keySet in interface Document
        Returns:
        The names of the fields in this object
      • clear

        public void clear()
        Description copied from interface: Document
        Remove all fields from this document.
        Specified by:
        clear in interface Document
      • has

        public boolean has​(CharSequence fieldName)
        Description copied from interface: Document
        Determine if this contains a field with the given name.
        Specified by:
        has in interface Document
        Parameters:
        fieldName - The name of the field
        Returns:
        true if the field exists, or false otherwise
      • hasAll

        public boolean hasAll​(Document that)
        Description copied from interface: Document
        Checks if this object contains all of the fields in the supplied document.
        Specified by:
        hasAll in interface Document
        Parameters:
        that - The document with the fields that should be in this document
        Returns:
        true if this document contains all of the fields in the supplied document, or false otherwise
      • get

        public Value get​(CharSequence fieldName,
                         Comparable<?> defaultValue)
        Description copied from interface: Document
        Gets the value in this document for the given field name.
        Specified by:
        get in interface Document
        Parameters:
        fieldName - The name of the field
        defaultValue - the default value to return if there is no such field
        Returns:
        The field value, if found, or , or defaultValue if there is no such field
      • putAll

        public Document putAll​(Iterable<Document.Field> object)
        Description copied from interface: Document
        Sets on this object all name/value pairs from the supplied object. If the supplied object is null, this method does nothing.
        Specified by:
        putAll in interface Document
        Parameters:
        object - the name/value pairs to be set on this object; may not be null
        Returns:
        This document, to allow for chaining methods
      • removeAll

        public Document removeAll()
        Description copied from interface: Document
        Remove all fields from this document.
        Specified by:
        removeAll in interface Document
        Returns:
        This document, to allow for chaining methods
      • remove

        public Value remove​(CharSequence name)
        Description copied from interface: Document
        Remove the field with the supplied name, and return the value.
        Specified by:
        remove in interface Document
        Parameters:
        name - The name of the field
        Returns:
        the value that was removed, or null if there was no such value
      • setValue

        public Document setValue​(CharSequence name,
                                 Value value)
        Description copied from interface: Document
        Set the value for the field with the given name.
        Specified by:
        setValue in interface Document
        Parameters:
        name - The name of the field
        value - the new value
        Returns:
        This document, to allow for chaining methods
      • increment

        public Document increment​(CharSequence name,
                                  Value increment)
        Description copied from interface: Document
        Increment the numeric value in the given field by the designated amount.
        Specified by:
        increment in interface Document
        Parameters:
        name - The name of the field
        increment - the amount to increment the existing value; may be negative to decrement
        Returns:
        this array to allow for chaining methods
      • clone

        public Document clone()
        Description copied from interface: Document
        Obtain a clone of this document.
        Specified by:
        clone in interface Document
        Overrides:
        clone in class Object
        Returns:
        the clone of this document; never null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object