001 002package com.commercetools.history.models.change; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * ChangeAttributeConstraintChangeBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * ChangeAttributeConstraintChange changeAttributeConstraintChange = ChangeAttributeConstraintChange.builder() 016 * .change("{change}") 017 * .previousValue(AttributeConstraintEnum.NONE) 018 * .nextValue(AttributeConstraintEnum.NONE) 019 * .attributeName("{attributeName}") 020 * .build() 021 * </code></pre> 022 * </div> 023 */ 024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 025public class ChangeAttributeConstraintChangeBuilder implements Builder<ChangeAttributeConstraintChange> { 026 027 private String change; 028 029 private com.commercetools.history.models.common.AttributeConstraintEnum previousValue; 030 031 private com.commercetools.history.models.common.AttributeConstraintEnum nextValue; 032 033 private String attributeName; 034 035 /** 036 * set the value to the change 037 * @param change value to be set 038 * @return Builder 039 */ 040 041 public ChangeAttributeConstraintChangeBuilder change(final String change) { 042 this.change = change; 043 return this; 044 } 045 046 /** 047 * <p>Value before the change.</p> 048 * @param previousValue value to be set 049 * @return Builder 050 */ 051 052 public ChangeAttributeConstraintChangeBuilder previousValue( 053 final com.commercetools.history.models.common.AttributeConstraintEnum previousValue) { 054 this.previousValue = previousValue; 055 return this; 056 } 057 058 /** 059 * <p>Value after the change.</p> 060 * @param nextValue value to be set 061 * @return Builder 062 */ 063 064 public ChangeAttributeConstraintChangeBuilder nextValue( 065 final com.commercetools.history.models.common.AttributeConstraintEnum nextValue) { 066 this.nextValue = nextValue; 067 return this; 068 } 069 070 /** 071 * <p>Name of the updated AttributeDefinition.</p> 072 * @param attributeName value to be set 073 * @return Builder 074 */ 075 076 public ChangeAttributeConstraintChangeBuilder attributeName(final String attributeName) { 077 this.attributeName = attributeName; 078 return this; 079 } 080 081 /** 082 * value of change} 083 * @return change 084 */ 085 086 public String getChange() { 087 return this.change; 088 } 089 090 /** 091 * <p>Value before the change.</p> 092 * @return previousValue 093 */ 094 095 public com.commercetools.history.models.common.AttributeConstraintEnum getPreviousValue() { 096 return this.previousValue; 097 } 098 099 /** 100 * <p>Value after the change.</p> 101 * @return nextValue 102 */ 103 104 public com.commercetools.history.models.common.AttributeConstraintEnum getNextValue() { 105 return this.nextValue; 106 } 107 108 /** 109 * <p>Name of the updated AttributeDefinition.</p> 110 * @return attributeName 111 */ 112 113 public String getAttributeName() { 114 return this.attributeName; 115 } 116 117 /** 118 * builds ChangeAttributeConstraintChange with checking for non-null required values 119 * @return ChangeAttributeConstraintChange 120 */ 121 public ChangeAttributeConstraintChange build() { 122 Objects.requireNonNull(change, ChangeAttributeConstraintChange.class + ": change is missing"); 123 Objects.requireNonNull(previousValue, ChangeAttributeConstraintChange.class + ": previousValue is missing"); 124 Objects.requireNonNull(nextValue, ChangeAttributeConstraintChange.class + ": nextValue is missing"); 125 Objects.requireNonNull(attributeName, ChangeAttributeConstraintChange.class + ": attributeName is missing"); 126 return new ChangeAttributeConstraintChangeImpl(change, previousValue, nextValue, attributeName); 127 } 128 129 /** 130 * builds ChangeAttributeConstraintChange without checking for non-null required values 131 * @return ChangeAttributeConstraintChange 132 */ 133 public ChangeAttributeConstraintChange buildUnchecked() { 134 return new ChangeAttributeConstraintChangeImpl(change, previousValue, nextValue, attributeName); 135 } 136 137 /** 138 * factory method for an instance of ChangeAttributeConstraintChangeBuilder 139 * @return builder 140 */ 141 public static ChangeAttributeConstraintChangeBuilder of() { 142 return new ChangeAttributeConstraintChangeBuilder(); 143 } 144 145 /** 146 * create builder for ChangeAttributeConstraintChange instance 147 * @param template instance with prefilled values for the builder 148 * @return builder 149 */ 150 public static ChangeAttributeConstraintChangeBuilder of(final ChangeAttributeConstraintChange template) { 151 ChangeAttributeConstraintChangeBuilder builder = new ChangeAttributeConstraintChangeBuilder(); 152 builder.change = template.getChange(); 153 builder.previousValue = template.getPreviousValue(); 154 builder.nextValue = template.getNextValue(); 155 builder.attributeName = template.getAttributeName(); 156 return builder; 157 } 158 159}