Package io.atomix.client
Class PrimitiveBuilder<B extends PrimitiveBuilder<B,P>,P extends SyncPrimitive>
java.lang.Object
io.atomix.client.PrimitiveBuilder<B,P>
- Type Parameters:
B- builder typeP- primitive type
- Direct Known Subclasses:
AtomicCounterBuilder,AtomicCounterMapBuilder,AtomicLockBuilder,AtomicMapBuilder,AtomicValueBuilder,DistributedLockBuilder,DistributedMultimapBuilder,DistributedSetBuilder,LeaderElectionBuilder
public abstract class PrimitiveBuilder<B extends PrimitiveBuilder<B,P>,P extends SyncPrimitive>
extends Object
Abstract builder for distributed primitives.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a new instance of the primitive.abstract CompletableFuture<P>Builds a new instance of the primitive asynchronously.Sets the primitive name.withSerializer(Serializer serializer) Sets the serializer for the primitive.Adds a tag to the primitive.Sets the primitive tags.
-
Method Details
-
withName
Sets the primitive name.- Parameters:
name- the primitive name- Returns:
- the primitive builder
-
withTags
Sets the primitive tags.- Parameters:
tags- the primitive tags- Returns:
- the primitive builder
-
withTag
Adds a tag to the primitive.- Parameters:
key- the tag keyvalue- the tag value- Returns:
- the primitive builder
-
withSerializer
Sets the serializer for the primitive.- Parameters:
serializer- the primitive serializer- Returns:
- the primitive builder
-
build
Builds a new instance of the primitive.The returned instance will be distinct from all other instances of the same primitive on this node, with a distinct session, ordering guarantees, memory, etc.
- Returns:
- a new instance of the primitive
-
buildAsync
Builds a new instance of the primitive asynchronously.The returned instance will be distinct from all other instances of the same primitive on this node, with a distinct session, ordering guarantees, memory, etc.
- Returns:
- asynchronous distributed primitive
-