001
002package com.commercetools.ml.models.common;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * TaskTokenBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     TaskToken taskToken = TaskToken.builder()
016 *             .taskId("{taskId}")
017 *             .uriPath("{uriPath}")
018 *             .build()
019 * </code></pre>
020 * </div>
021 */
022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
023public class TaskTokenBuilder implements Builder<TaskToken> {
024
025    private String taskId;
026
027    private String uriPath;
028
029    /**
030     *  <p>The ID for the task. Used to find the status of the task.</p>
031     */
032
033    public TaskTokenBuilder taskId(final String taskId) {
034        this.taskId = taskId;
035        return this;
036    }
037
038    /**
039     *  <p>The URI path to poll for the status of the task.</p>
040     */
041
042    public TaskTokenBuilder uriPath(final String uriPath) {
043        this.uriPath = uriPath;
044        return this;
045    }
046
047    public String getTaskId() {
048        return this.taskId;
049    }
050
051    public String getUriPath() {
052        return this.uriPath;
053    }
054
055    public TaskToken build() {
056        Objects.requireNonNull(taskId, TaskToken.class + ": taskId is missing");
057        Objects.requireNonNull(uriPath, TaskToken.class + ": uriPath is missing");
058        return new TaskTokenImpl(taskId, uriPath);
059    }
060
061    /**
062     * builds TaskToken without checking for non null required values
063     */
064    public TaskToken buildUnchecked() {
065        return new TaskTokenImpl(taskId, uriPath);
066    }
067
068    public static TaskTokenBuilder of() {
069        return new TaskTokenBuilder();
070    }
071
072    public static TaskTokenBuilder of(final TaskToken template) {
073        TaskTokenBuilder builder = new TaskTokenBuilder();
074        builder.taskId = template.getTaskId();
075        builder.uriPath = template.getUriPath();
076        return builder;
077    }
078
079}