Class CounterValue

java.lang.Object
org.infinispan.counter.impl.entries.CounterValue

@Immutable @ProtoTypeId(125) public class CounterValue extends Object
Stores the counter's value and CounterState.

If the counter isn't bounded, the state is always CounterState.VALID.

Since:
9.0
Author:
Pedro Ruivo
  • Method Details

    • newCounterValue

      public static CounterValue newCounterValue(long value)
      Creates a new valid CounterValue with the value.
      Parameters:
      value - the counter's value.
      Returns:
      the CounterValue.
    • newCounterValue

      public static CounterValue newCounterValue(long value, long lowerBound, long upperBound)
      Creates a new CounterValue with the value and state based on the boundaries.
      Parameters:
      value - the counter's value.
      lowerBound - the counter's lower bound.
      upperBound - the counter's upper bound.
      Returns:
      the CounterValue.
    • newCounterValue

      public static CounterValue newCounterValue(long value, org.infinispan.counter.api.CounterState state)
      Creates a new CounterValue with the value and state.
      Parameters:
      value - the counter's value.
      state - the counter's state.
      Returns:
      the CounterValue.
    • newCounterValue

      public static CounterValue newCounterValue(org.infinispan.counter.api.CounterConfiguration configuration)
      Creates the initial CounterValue based on CounterConfiguration.
      Parameters:
      configuration - the configuration.
      Returns:
      the CounterValue.
    • newCounterValue

      public static CounterValue newCounterValue(long currentValue, org.infinispan.counter.api.CounterConfiguration configuration)
      Creates the initial CounterValue based on currentValue and the CounterConfiguration.
      Parameters:
      currentValue - the current counter's value.
      configuration - the configuration.
      Returns:
      the CounterValue.
    • getValue

      @ProtoField(number=1, defaultValue="0") public long getValue()
      Returns:
      the counter's value.
    • getState

      @ProtoField(2) public org.infinispan.counter.api.CounterState getState()
      Returns:
      the counter's state.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object