Class UniqueResultStructure<R>

    • Method Detail

      • createWith

        public static <R> UniqueResultStructure<R> createWith​(R resultValue)
        Creates a new ResultSet with the given resultValue as its only result value. The resultValue must not be null.
      • get

        public SearchStructure<R> get​(java.lang.Object key)
        Description copied from class: SearchStructure
        Returns the nested SearchStructure for the given key. This method never returns null. If no value exists for a given key an EmptySearchStructure is returned as a fall-back.
        Specified by:
        get in class SearchStructure<R>
        Parameters:
        key - The key for the requested nested SearchStructure
        Returns:
        The nested SearchStructure or an EmptySearchStructure if the key does not exist.
      • merge

        public void merge​(UniqueResultStructure<R> otherStructure)
        Description copied from interface: MergeAndCopyStructure
        Merging adds the contents of the otherMergable to this object. This object then contains the combined content. The other object remains unchanged.Merging a SearchStructure deletes no content, instead equal values are being merged recursively.
        Specified by:
        merge in interface MergeAndCopyStructure<R>
        Parameters:
        otherStructure - The object that should be merged into this object
      • getUnique

        public R getUnique​(R defaultValue)
        Description copied from class: SearchStructure
        Returns the value if there is exactly one value or the given defaultValue if this structure is empty.

        Use this method if you know there should be at most one result value. This method throws an AssertionError if there is more than one value.

        Overrides:
        getUnique in class SearchStructure<R>
        Parameters:
        defaultValue - The defaultValue which is returned if this SearchStructure is empty.
        Returns:
        The result hold by this SearchStructure or the defaultValue if the structure is empty.
      • getUnique

        public R getUnique()
        Description copied from class: SearchStructure
        Returns the value if there is exactly one value.

        Use this method if you know there should be exactly one result value. This method throws an AssertionError if there is more than one values. If there is no value it throws an NoSuchElementException exception.

        Overrides:
        getUnique in class SearchStructure<R>
        Returns:
        The one and only result hold by this SearchStructure.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object