Class PrimitiveBuilder<B extends PrimitiveBuilder<B,P>,P extends SyncPrimitive>

java.lang.Object
io.atomix.client.PrimitiveBuilder<B,P>
Type Parameters:
B - builder type
P - 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 Details

    • withName

      public B withName(String name)
      Sets the primitive name.
      Parameters:
      name - the primitive name
      Returns:
      the primitive builder
    • withTags

      public B withTags(Map<String,String> tags)
      Sets the primitive tags.
      Parameters:
      tags - the primitive tags
      Returns:
      the primitive builder
    • withTag

      public B withTag(String key, String value)
      Adds a tag to the primitive.
      Parameters:
      key - the tag key
      value - the tag value
      Returns:
      the primitive builder
    • withSerializer

      public B withSerializer(Serializer serializer)
      Sets the serializer for the primitive.
      Parameters:
      serializer - the primitive serializer
      Returns:
      the primitive builder
    • build

      public P 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

      public abstract CompletableFuture<P> 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