001 002package com.commercetools.history.models.change; 003 004import java.util.*; 005import java.util.function.Function; 006 007import io.vrap.rmf.base.client.Builder; 008import io.vrap.rmf.base.client.utils.Generated; 009 010/** 011 * ChangeReviewRatingStatisticsChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * ChangeReviewRatingStatisticsChange changeReviewRatingStatisticsChange = ChangeReviewRatingStatisticsChange.builder() 017 * .change("{change}") 018 * .previousValue(previousValueBuilder -> previousValueBuilder) 019 * .nextValue(nextValueBuilder -> nextValueBuilder) 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 ChangeReviewRatingStatisticsChangeBuilder implements Builder<ChangeReviewRatingStatisticsChange> { 026 027 private String change; 028 029 private com.commercetools.history.models.common.ReviewRatingStatistics previousValue; 030 031 private com.commercetools.history.models.common.ReviewRatingStatistics nextValue; 032 033 /** 034 * set the value to the change 035 * @param change value to be set 036 * @return Builder 037 */ 038 039 public ChangeReviewRatingStatisticsChangeBuilder change(final String change) { 040 this.change = change; 041 return this; 042 } 043 044 /** 045 * <p>Value before the change.</p> 046 * @param builder function to build the previousValue value 047 * @return Builder 048 */ 049 050 public ChangeReviewRatingStatisticsChangeBuilder previousValue( 051 Function<com.commercetools.history.models.common.ReviewRatingStatisticsBuilder, com.commercetools.history.models.common.ReviewRatingStatisticsBuilder> builder) { 052 this.previousValue = builder.apply(com.commercetools.history.models.common.ReviewRatingStatisticsBuilder.of()) 053 .build(); 054 return this; 055 } 056 057 /** 058 * <p>Value before the change.</p> 059 * @param builder function to build the previousValue value 060 * @return Builder 061 */ 062 063 public ChangeReviewRatingStatisticsChangeBuilder withPreviousValue( 064 Function<com.commercetools.history.models.common.ReviewRatingStatisticsBuilder, com.commercetools.history.models.common.ReviewRatingStatistics> builder) { 065 this.previousValue = builder.apply(com.commercetools.history.models.common.ReviewRatingStatisticsBuilder.of()); 066 return this; 067 } 068 069 /** 070 * <p>Value before the change.</p> 071 * @param previousValue value to be set 072 * @return Builder 073 */ 074 075 public ChangeReviewRatingStatisticsChangeBuilder previousValue( 076 final com.commercetools.history.models.common.ReviewRatingStatistics previousValue) { 077 this.previousValue = previousValue; 078 return this; 079 } 080 081 /** 082 * <p>Value after the change.</p> 083 * @param builder function to build the nextValue value 084 * @return Builder 085 */ 086 087 public ChangeReviewRatingStatisticsChangeBuilder nextValue( 088 Function<com.commercetools.history.models.common.ReviewRatingStatisticsBuilder, com.commercetools.history.models.common.ReviewRatingStatisticsBuilder> builder) { 089 this.nextValue = builder.apply(com.commercetools.history.models.common.ReviewRatingStatisticsBuilder.of()) 090 .build(); 091 return this; 092 } 093 094 /** 095 * <p>Value after the change.</p> 096 * @param builder function to build the nextValue value 097 * @return Builder 098 */ 099 100 public ChangeReviewRatingStatisticsChangeBuilder withNextValue( 101 Function<com.commercetools.history.models.common.ReviewRatingStatisticsBuilder, com.commercetools.history.models.common.ReviewRatingStatistics> builder) { 102 this.nextValue = builder.apply(com.commercetools.history.models.common.ReviewRatingStatisticsBuilder.of()); 103 return this; 104 } 105 106 /** 107 * <p>Value after the change.</p> 108 * @param nextValue value to be set 109 * @return Builder 110 */ 111 112 public ChangeReviewRatingStatisticsChangeBuilder nextValue( 113 final com.commercetools.history.models.common.ReviewRatingStatistics nextValue) { 114 this.nextValue = nextValue; 115 return this; 116 } 117 118 /** 119 * value of change} 120 * @return change 121 */ 122 123 public String getChange() { 124 return this.change; 125 } 126 127 /** 128 * <p>Value before the change.</p> 129 * @return previousValue 130 */ 131 132 public com.commercetools.history.models.common.ReviewRatingStatistics getPreviousValue() { 133 return this.previousValue; 134 } 135 136 /** 137 * <p>Value after the change.</p> 138 * @return nextValue 139 */ 140 141 public com.commercetools.history.models.common.ReviewRatingStatistics getNextValue() { 142 return this.nextValue; 143 } 144 145 /** 146 * builds ChangeReviewRatingStatisticsChange with checking for non-null required values 147 * @return ChangeReviewRatingStatisticsChange 148 */ 149 public ChangeReviewRatingStatisticsChange build() { 150 Objects.requireNonNull(change, ChangeReviewRatingStatisticsChange.class + ": change is missing"); 151 Objects.requireNonNull(previousValue, ChangeReviewRatingStatisticsChange.class + ": previousValue is missing"); 152 Objects.requireNonNull(nextValue, ChangeReviewRatingStatisticsChange.class + ": nextValue is missing"); 153 return new ChangeReviewRatingStatisticsChangeImpl(change, previousValue, nextValue); 154 } 155 156 /** 157 * builds ChangeReviewRatingStatisticsChange without checking for non-null required values 158 * @return ChangeReviewRatingStatisticsChange 159 */ 160 public ChangeReviewRatingStatisticsChange buildUnchecked() { 161 return new ChangeReviewRatingStatisticsChangeImpl(change, previousValue, nextValue); 162 } 163 164 /** 165 * factory method for an instance of ChangeReviewRatingStatisticsChangeBuilder 166 * @return builder 167 */ 168 public static ChangeReviewRatingStatisticsChangeBuilder of() { 169 return new ChangeReviewRatingStatisticsChangeBuilder(); 170 } 171 172 /** 173 * create builder for ChangeReviewRatingStatisticsChange instance 174 * @param template instance with prefilled values for the builder 175 * @return builder 176 */ 177 public static ChangeReviewRatingStatisticsChangeBuilder of(final ChangeReviewRatingStatisticsChange template) { 178 ChangeReviewRatingStatisticsChangeBuilder builder = new ChangeReviewRatingStatisticsChangeBuilder(); 179 builder.change = template.getChange(); 180 builder.previousValue = template.getPreviousValue(); 181 builder.nextValue = template.getNextValue(); 182 return builder; 183 } 184 185}