001 002package com.commercetools.history.models.label; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * ReviewLabelBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * ReviewLabel reviewLabel = ReviewLabel.builder() 016 * .key("{key}") 017 * .title("{title}") 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 ReviewLabelBuilder implements Builder<ReviewLabel> { 024 025 private String key; 026 027 private String title; 028 029 /** 030 * <p>User-defined unique identifier of the Review.</p> 031 * @param key value to be set 032 * @return Builder 033 */ 034 035 public ReviewLabelBuilder key(final String key) { 036 this.key = key; 037 return this; 038 } 039 040 /** 041 * <p>Title of the Review.</p> 042 * @param title value to be set 043 * @return Builder 044 */ 045 046 public ReviewLabelBuilder title(final String title) { 047 this.title = title; 048 return this; 049 } 050 051 /** 052 * <p>User-defined unique identifier of the Review.</p> 053 * @return key 054 */ 055 056 public String getKey() { 057 return this.key; 058 } 059 060 /** 061 * <p>Title of the Review.</p> 062 * @return title 063 */ 064 065 public String getTitle() { 066 return this.title; 067 } 068 069 /** 070 * builds ReviewLabel with checking for non-null required values 071 * @return ReviewLabel 072 */ 073 public ReviewLabel build() { 074 Objects.requireNonNull(key, ReviewLabel.class + ": key is missing"); 075 Objects.requireNonNull(title, ReviewLabel.class + ": title is missing"); 076 return new ReviewLabelImpl(key, title); 077 } 078 079 /** 080 * builds ReviewLabel without checking for non-null required values 081 * @return ReviewLabel 082 */ 083 public ReviewLabel buildUnchecked() { 084 return new ReviewLabelImpl(key, title); 085 } 086 087 /** 088 * factory method for an instance of ReviewLabelBuilder 089 * @return builder 090 */ 091 public static ReviewLabelBuilder of() { 092 return new ReviewLabelBuilder(); 093 } 094 095 /** 096 * create builder for ReviewLabel instance 097 * @param template instance with prefilled values for the builder 098 * @return builder 099 */ 100 public static ReviewLabelBuilder of(final ReviewLabel template) { 101 ReviewLabelBuilder builder = new ReviewLabelBuilder(); 102 builder.key = template.getKey(); 103 builder.title = template.getTitle(); 104 return builder; 105 } 106 107}