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