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 * CustomObjectLabelBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * CustomObjectLabel customObjectLabel = CustomObjectLabel.builder() 016 * .key("{key}") 017 * .container("{container}") 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 CustomObjectLabelBuilder implements Builder<CustomObjectLabel> { 024 025 private String key; 026 027 private String container; 028 029 /** 030 * <p>User-defined unique identifier of the CustomObject within the defined <code>container</code>.</p> 031 * @param key value to be set 032 * @return Builder 033 */ 034 035 public CustomObjectLabelBuilder key(final String key) { 036 this.key = key; 037 return this; 038 } 039 040 /** 041 * <p>Namespace to group Custom Objects.</p> 042 * @param container value to be set 043 * @return Builder 044 */ 045 046 public CustomObjectLabelBuilder container(final String container) { 047 this.container = container; 048 return this; 049 } 050 051 /** 052 * <p>User-defined unique identifier of the CustomObject within the defined <code>container</code>.</p> 053 * @return key 054 */ 055 056 public String getKey() { 057 return this.key; 058 } 059 060 /** 061 * <p>Namespace to group Custom Objects.</p> 062 * @return container 063 */ 064 065 public String getContainer() { 066 return this.container; 067 } 068 069 /** 070 * builds CustomObjectLabel with checking for non-null required values 071 * @return CustomObjectLabel 072 */ 073 public CustomObjectLabel build() { 074 Objects.requireNonNull(key, CustomObjectLabel.class + ": key is missing"); 075 Objects.requireNonNull(container, CustomObjectLabel.class + ": container is missing"); 076 return new CustomObjectLabelImpl(key, container); 077 } 078 079 /** 080 * builds CustomObjectLabel without checking for non-null required values 081 * @return CustomObjectLabel 082 */ 083 public CustomObjectLabel buildUnchecked() { 084 return new CustomObjectLabelImpl(key, container); 085 } 086 087 /** 088 * factory method for an instance of CustomObjectLabelBuilder 089 * @return builder 090 */ 091 public static CustomObjectLabelBuilder of() { 092 return new CustomObjectLabelBuilder(); 093 } 094 095 /** 096 * create builder for CustomObjectLabel instance 097 * @param template instance with prefilled values for the builder 098 * @return builder 099 */ 100 public static CustomObjectLabelBuilder of(final CustomObjectLabel template) { 101 CustomObjectLabelBuilder builder = new CustomObjectLabelBuilder(); 102 builder.key = template.getKey(); 103 builder.container = template.getContainer(); 104 return builder; 105 } 106 107}