Class ProofEntryIndexProxy<T>

    • Field Detail

      • serializer

        protected final com.exonum.binding.common.serialization.CheckingSerializerDecorator<T> serializer
    • Method Detail

      • getIndexHash

        public com.exonum.binding.common.hash.HashCode getIndexHash()
        Description copied from interface: ProofEntryIndex
        Returns the index hash which represents the complete state of this entry. Any modifications to this entry affect the index hash.

        The entry index hash is computed as SHA-256 of the entry binary representation, or a hash of zeroes if the entry is not set.

        Specified by:
        getIndexHash in interface HashableIndex
        Specified by:
        getIndexHash in interface ProofEntryIndex<T>
      • nativeSet

        protected void nativeSet​(long nativeHandle,
                                 byte[] value)
      • nativeIsPresent

        protected boolean nativeIsPresent​(long nativeHandle)
      • nativeGet

        protected byte[] nativeGet​(long nativeHandle)
      • nativeGetIndexHash

        protected byte[] nativeGetIndexHash​(long nativeHandle)
      • nativeRemove

        protected void nativeRemove​(long nativeHandle)
      • set

        public void set​(T value)
        Description copied from interface: EntryIndex
        Sets a new value of the entry, overwriting the previous value.
        Specified by:
        set in interface EntryIndex<T>
        Parameters:
        value - a value to set. Must not be null.
      • isPresent

        public boolean isPresent()
        Description copied from interface: EntryIndex
        Returns true if this entry exists in the database.
        Specified by:
        isPresent in interface EntryIndex<T>
      • orElse

        public T orElse​(T valueIfAbsent)
        Description copied from interface: EntryIndex
        Returns the value of this entry, if it is present; otherwise, the given value.
        Specified by:
        orElse in interface EntryIndex<T>
        Parameters:
        valueIfAbsent - a value to return if there is none in this entry
      • remove

        public void remove()
        Description copied from interface: EntryIndex
        Removes a value from this entry.
        Specified by:
        remove in interface EntryIndex<T>
      • toOptional

        public Optional<T> toOptional()
        Description copied from interface: EntryIndex
        Converts the entry to Optional.

        Be aware that this method represents a state of the entry at the time of calling. And the returned value won't reflect the entry changes:

          
            entry.set("foo");
            Optional<String> optionalEntry = entry.toOptional();
            entry.remove();
            optionalEntry.get(); // -> returns "foo"
          
         
        Specified by:
        toOptional in interface EntryIndex<T>
        Returns:
        Optional.of(value) if value is present in the entry, otherwise returns Optional.empty()
      • getAddress

        public IndexAddress getAddress()
        Description copied from interface: StorageIndex
        Returns the index address: its identifier in the database.

        Please note that the implementations may return either relative or absolute address. The address is not required to be equal to the one passed to the index constructor.

        Specified by:
        getAddress in interface StorageIndex