001 002package com.commercetools.api.models.error; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * InvalidInputErrorBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * InvalidInputError invalidInputError = InvalidInputError.builder() 016 * .message("{message}") 017 * .build() 018 * </code></pre> 019 * </div> 020 */ 021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 022public class InvalidInputErrorBuilder implements Builder<InvalidInputError> { 023 024 private String message; 025 026 private Map<String, java.lang.Object> values = new HashMap<>(); 027 028 /** 029 * <p>Description of the constraints that are not met by the request. For example, <code>"Invalid $propertyName. It may be a non-empty string up to $maxLength"</code>.</p> 030 * @param message value to be set 031 * @return Builder 032 */ 033 034 public InvalidInputErrorBuilder message(final String message) { 035 this.message = message; 036 return this; 037 } 038 039 /** 040 * <p>Error-specific additional fields.</p> 041 * @param values properties to be set 042 * @return Builder 043 */ 044 045 public InvalidInputErrorBuilder values(final Map<String, java.lang.Object> values) { 046 this.values = values; 047 return this; 048 } 049 050 /** 051 * <p>Error-specific additional fields.</p> 052 * @param key property name 053 * @param value property value 054 * @return Builder 055 */ 056 057 public InvalidInputErrorBuilder addValue(final String key, final java.lang.Object value) { 058 if (this.values == null) { 059 values = new HashMap<>(); 060 } 061 values.put(key, value); 062 return this; 063 } 064 065 /** 066 * <p>Description of the constraints that are not met by the request. For example, <code>"Invalid $propertyName. It may be a non-empty string up to $maxLength"</code>.</p> 067 * @return message 068 */ 069 070 public String getMessage() { 071 return this.message; 072 } 073 074 /** 075 * <p>Error-specific additional fields.</p> 076 * @return pattern properties 077 */ 078 079 public Map<String, java.lang.Object> getValues() { 080 return this.values; 081 } 082 083 /** 084 * builds InvalidInputError with checking for non-null required values 085 * @return InvalidInputError 086 */ 087 public InvalidInputError build() { 088 Objects.requireNonNull(message, InvalidInputError.class + ": message is missing"); 089 return new InvalidInputErrorImpl(message, values); 090 } 091 092 /** 093 * builds InvalidInputError without checking for non-null required values 094 * @return InvalidInputError 095 */ 096 public InvalidInputError buildUnchecked() { 097 return new InvalidInputErrorImpl(message, values); 098 } 099 100 /** 101 * factory method for an instance of InvalidInputErrorBuilder 102 * @return builder 103 */ 104 public static InvalidInputErrorBuilder of() { 105 return new InvalidInputErrorBuilder(); 106 } 107 108 /** 109 * create builder for InvalidInputError instance 110 * @param template instance with prefilled values for the builder 111 * @return builder 112 */ 113 public static InvalidInputErrorBuilder of(final InvalidInputError template) { 114 InvalidInputErrorBuilder builder = new InvalidInputErrorBuilder(); 115 builder.message = template.getMessage(); 116 builder.values = template.values(); 117 return builder; 118 } 119 120}