001 002package com.commercetools.api.models.message; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * ContainerAndKeyBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * ContainerAndKey containerAndKey = ContainerAndKey.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 ContainerAndKeyBuilder implements Builder<ContainerAndKey> { 024 025 private String key; 026 027 private String container; 028 029 /** 030 * <p>User-defined identifier that is unique within the given container.</p> 031 * @param key value to be set 032 * @return Builder 033 */ 034 035 public ContainerAndKeyBuilder 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 ContainerAndKeyBuilder container(final String container) { 047 this.container = container; 048 return this; 049 } 050 051 /** 052 * <p>User-defined identifier that is unique within the given container.</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 ContainerAndKey with checking for non-null required values 071 * @return ContainerAndKey 072 */ 073 public ContainerAndKey build() { 074 Objects.requireNonNull(key, ContainerAndKey.class + ": key is missing"); 075 Objects.requireNonNull(container, ContainerAndKey.class + ": container is missing"); 076 return new ContainerAndKeyImpl(key, container); 077 } 078 079 /** 080 * builds ContainerAndKey without checking for non-null required values 081 * @return ContainerAndKey 082 */ 083 public ContainerAndKey buildUnchecked() { 084 return new ContainerAndKeyImpl(key, container); 085 } 086 087 /** 088 * factory method for an instance of ContainerAndKeyBuilder 089 * @return builder 090 */ 091 public static ContainerAndKeyBuilder of() { 092 return new ContainerAndKeyBuilder(); 093 } 094 095 /** 096 * create builder for ContainerAndKey instance 097 * @param template instance with prefilled values for the builder 098 * @return builder 099 */ 100 public static ContainerAndKeyBuilder of(final ContainerAndKey template) { 101 ContainerAndKeyBuilder builder = new ContainerAndKeyBuilder(); 102 builder.key = template.getKey(); 103 builder.container = template.getContainer(); 104 return builder; 105 } 106 107}