Class Context.Builder<T extends Context.Builder<T>>

java.lang.Object
io.aiven.commons.kafka.connector.source.task.Context.Builder<T>
Type Parameters:
T - the class of the actual builder.
Enclosing class:
Context

public abstract static class Context.Builder<T extends Context.Builder<T>> extends Object
The abstract builder.
  • Constructor Details

    • Builder

      protected Builder(Comparable<?> nativeKey)
      Constructs a builder with the native key.
      Parameters:
      nativeKey - the native key for the Context.
    • Builder

      protected Builder(Context context)
      Constructs a builder with the native key.
      Parameters:
      context - the context to extract the properties from..
    • Builder

      protected Builder(Map<String,Object> properties)
      Constructs a builder from an existing context.
      Parameters:
      properties - the properties for the context
  • Method Details

    • build

      public abstract Context build()
      Build the context. Builders should override this method to call the constructor on the desired Context type.
      Returns:
      the new context.
    • addValidator

      protected final void addValidator(Context.Builder.Validator validator)
      Add a validator the the builder check.
      Parameters:
      validator - the Validator to add.
    • self

      public final T self()
      Return a reference to this as the class of this builder not the base AbstractBuilder. Used to ensure that additional builder functionality returns the proper type.
      Returns:
      this builder cast to <T> type.
    • nativeKey

      public final T nativeKey(Comparable<?> nativeKey)
      Sets the native key.
      Parameters:
      nativeKey - the native key to use.
      Returns:
      the this.
    • topic

      public final T topic(String topic)
      Sets the topic
      Parameters:
      topic - The topic for the context.
      Returns:
      this
    • partition

      public final T partition(Integer partition)
      Sets the partition.
      Parameters:
      partition - hhe partition for this context.
      Returns:
      this
    • offset

      public final T offset(Long offset)
      Sets the offset.
      Parameters:
      offset - the offset for this context.
      Returns:
      this.
    • set

      public final T set(String key, Object object)
      Sets an arbitrary property for the context.
      Parameters:
      key - the key for the property.
      object - the property value.
      Returns:
      this.
    • validate

      public final void validate()
      Validate that the builder has all the required properties.