Interface EntryView.ReadEntryView<K,V>

All Superinterfaces:
MetaParam.Lookup
All Known Subinterfaces:
EntryView.ReadWriteEntryView<K,V>, EntryViews.AccessLoggingReadWriteView<K,V>
Enclosing class:
EntryView

@Experimental public static interface EntryView.ReadEntryView<K,V> extends MetaParam.Lookup
Expose read-only information about a cache entry potentially associated with a key in the functional map. Typically, if the key is associated with a cache entry, that information will include value and optional MetaParam information.

It exposes both get() and find() methods for convenience. If the caller knows for sure that the value will be present, get() offers the convenience of retrieving the value directly without having to get an Optional first. As a result of this, get() throws NoSuchElementException if there's no value associated with the entry. If the caller is unsure of whether the value is present, find() should be used. This approach avoids the user having to do null checks.

Since:
8.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional value.
    get()
    Returns a non-null value if the key has a value associated with it or throws NoSuchElementException if no value is associated with the entry.
    key()
    Key of the read-only entry view.
    default Optional<V>
    The same as find() but does not update any hit/miss statistics.

    Methods inherited from interface org.infinispan.functional.MetaParam.Lookup

    findMetaParam
  • Method Details

    • key

      K key()
      Key of the read-only entry view. Guaranteed to return a non-null value. The instance of the key must not be mutated.
    • get

      Returns a non-null value if the key has a value associated with it or throws NoSuchElementException if no value is associated with the entry.

      The value instance is read-only and must not be mutated. If the function accessing this value is about to update the entry, it has to create a defensive copy (or completely new instance) and store it using EntryView.WriteEntryView.set(Object, MetaParam.Writable[]).

      Throws:
      NoSuchElementException - if no value is associated with the key.
    • find

      Optional<V> find()
      Optional value. It'll return a non-empty value when the value is present, and empty when the value is not present.

      The value instance is read-only and must not be mutated. If the function accessing this value is about to update the entry, it has to create a defensive copy (or completely new instance) and store it using EntryView.WriteEntryView.set(Object, MetaParam.Writable[]).

    • peek

      default Optional<V> peek()
      The same as find() but does not update any hit/miss statistics.
      Returns: