Package io.ably.lib.liveobjects.value
Class LiveCounter
java.lang.Object
io.ably.lib.liveobjects.value.LiveCounter
An immutable value type representing the intent to create a new
LiveCounter object with a specific initial count. Passed to mutation
methods (such as LiveMapInstance#set or LiveMapPathObject#set,
wrapped via LiveMapValue.of(LiveCounter)) to assign a new
LiveCounter to the objects graph.
This type is a holder for the initial value only - it is not a live,
subscribable view of channel state. The COUNTER_CREATE operation it
gives rise to is published when the enclosing mutation is applied.
Instances are obtained via the static create(Number) factory and
are immutable after creation. The initial count is held internally by the
implementation; it has no public accessor.
Spec: RTLCV1, RTLCV2, RTLCV3
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedExtended by the LiveObjects implementation; not intended for application subclassing. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull LiveCountercreate()Creates a newLiveCountervalue type with an initial count of 0.static @NotNull LiveCounterCreates a newLiveCountervalue type with the given initial count.
-
Constructor Details
-
LiveCounter
protected LiveCounter()Extended by the LiveObjects implementation; not intended for application subclassing. Avoids implicit empty public constructor.
-
-
Method Details
-
create
Creates a newLiveCountervalue type with an initial count of 0.Spec: RTLCV3, RTLCV3a1, RTLCV3b
- Returns:
- an immutable
LiveCountervalue type - Throws:
-
IllegalStateException- if the LiveObjects plugin is not on the classpath
-
create
Creates a newLiveCountervalue type with the given initial count. No input validation is performed at creation time; validation is deferred to when the value is evaluated by a mutation method.Spec: RTLCV3, RTLCV3b, RTLCV3c, RTLCV3d
- Parameters:
-
initialCount- the initial count for the newLiveCounterobject - Returns:
- an immutable
LiveCountervalue type - Throws:
-
IllegalStateException- if the LiveObjects plugin is not on the classpath
-