Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
public class RepartitionHint {

    public final String topicName;
    public final Integer topicPartitions;
    public final Boolean repartitionRequired;

    private RepartitionHint (String topicName) {
        this.topicName = topicName;
        this.topicPartitions = null;
        this.repartitionRequired = true;
    }

    private RepartitionHint (String topicName, Integer topicPartitions) {
        this.topicName = topicName;
        this.topicPartitions = topicPartitions;
        this.repartitionRequired = true;
    }

    private RepartitionHint (Boolean repartitionRequired) {
        this.topicName = null;
        this.topicPartitions = null;
        this.repartitionRequired = repartitionRequired;
    }
    
    private RepartitionHint (String topicName, Integer topicPartitions, Boolean repartitionRequired) {
        this.topicName = topicName;
        this.topicPartitions = topicPartitions;
        this.repartitionRequired = repartitionRequired;
    }

    public String getTopicName() {
        return topicName;
    }

    public Integer getTopicPartitions() {
        return topicPartitions;
    }
 
	public RepartitionHint withTopicName(String topicName) {
       this.topicName = topicName;
		return this;
    }
 
	public RepartitionHint withTopicPartitions(String topicPartitions) {
       this.topicPartitions = topicPartitions;
		return this;
    }
 
	public RepartitionHint requiredRepartition(Boolean repartitionRequired) {
       this.repartitionRequired = repartitionRequired;
		return this;
    }
}

 

Proposed Changes

 

We try to avoid many overloads by not implementing all the overloaded combinations of related methods.

...