View Javadoc

1   package com.atlassian.cache;
2   
3   import com.atlassian.annotations.PublicApi;
4   
5   import javax.annotation.Nullable;
6   
7   /**
8    * A resettable reference event.
9    * <p/>
10   * NOTE: Although Cache Reference does not support {@code null} as a valid value we are using it in {@code getValue}
11   * as a way to represent missing value. We have the following reasons for this:
12   * <ul>
13   *     <li>Firstly, some events inherently do not have value. For instance resetting does not have a value as the
14   *     corresponding element was just removed from the cached reference</li>
15   *     <li>Secondly, in some implementations the information for the value and/or old value is not available at all.</li>
16   *     <li>Thirdly, the listener can be added as a valueless listener</li>
17   * </ul>
18   *
19   * @since 2.4
20   */
21  @PublicApi
22  public interface CachedReferenceEvent<V>
23  {
24      /**
25       * Returns cached reference value
26       *
27       * @return the value. For details why is this method marked as {@code Nullable} please refer to the
28       * class level documentation
29       */
30      @Nullable
31      V getValue();
32  }