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
The abstract builder.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefines a validation chack for the context properties. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaddValidator(Context.Builder.Validator validator) Add a validator the the builder check.abstract Contextbuild()Build the context.final TnativeKey(Comparable<?> nativeKey) Sets the native key.final TSets the offset.final TSets the partition.final Tself()Return a reference to this as the class of this builder not the base AbstractBuilder.final TSets an arbitrary property for the context.final TSets the topicfinal voidvalidate()Validate that the builder has all the required properties.
-
Constructor Details
-
Builder
Constructs a builder with the native key.- Parameters:
nativeKey- the native key for the Context.
-
Builder
Constructs a builder with the native key.- Parameters:
context- the context to extract the properties from..
-
Builder
Constructs a builder from an existing context.- Parameters:
properties- the properties for the context
-
-
Method Details
-
build
Build the context. Builders should override this method to call the constructor on the desired Context type.- Returns:
- the new context.
-
addValidator
Add a validator the the builder check.- Parameters:
validator- the Validator to add.
-
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
Sets the native key.- Parameters:
nativeKey- the native key to use.- Returns:
- the this.
-
topic
Sets the topic- Parameters:
topic- The topic for the context.- Returns:
- this
-
partition
Sets the partition.- Parameters:
partition- hhe partition for this context.- Returns:
- this
-
offset
Sets the offset.- Parameters:
offset- the offset for this context.- Returns:
- this.
-
set
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.
-