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 * @param taskId value to be set 032 * @return Builder 033 */ 034 035 public TaskTokenBuilder taskId(final String taskId) { 036 this.taskId = taskId; 037 return this; 038 } 039 040 /** 041 * <p>The URI path to poll for the status of the task.</p> 042 * @param uriPath value to be set 043 * @return Builder 044 */ 045 046 public TaskTokenBuilder uriPath(final String uriPath) { 047 this.uriPath = uriPath; 048 return this; 049 } 050 051 /** 052 * <p>The ID for the task. Used to find the status of the task.</p> 053 * @return taskId 054 */ 055 056 public String getTaskId() { 057 return this.taskId; 058 } 059 060 /** 061 * <p>The URI path to poll for the status of the task.</p> 062 * @return uriPath 063 */ 064 065 public String getUriPath() { 066 return this.uriPath; 067 } 068 069 /** 070 * builds TaskToken with checking for non-null required values 071 * @return TaskToken 072 */ 073 public TaskToken build() { 074 Objects.requireNonNull(taskId, TaskToken.class + ": taskId is missing"); 075 Objects.requireNonNull(uriPath, TaskToken.class + ": uriPath is missing"); 076 return new TaskTokenImpl(taskId, uriPath); 077 } 078 079 /** 080 * builds TaskToken without checking for non-null required values 081 * @return TaskToken 082 */ 083 public TaskToken buildUnchecked() { 084 return new TaskTokenImpl(taskId, uriPath); 085 } 086 087 /** 088 * factory method for an instance of TaskTokenBuilder 089 * @return builder 090 */ 091 public static TaskTokenBuilder of() { 092 return new TaskTokenBuilder(); 093 } 094 095 /** 096 * create builder for TaskToken instance 097 * @param template instance with prefilled values for the builder 098 * @return builder 099 */ 100 public static TaskTokenBuilder of(final TaskToken template) { 101 TaskTokenBuilder builder = new TaskTokenBuilder(); 102 builder.taskId = template.getTaskId(); 103 builder.uriPath = template.getUriPath(); 104 return builder; 105 } 106 107}