001 002package com.commercetools.history.models.common; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.Valid; 010import javax.validation.constraints.NotNull; 011 012import com.fasterxml.jackson.annotation.*; 013import com.fasterxml.jackson.databind.annotation.*; 014 015import io.vrap.rmf.base.client.utils.Generated; 016 017/** 018 * Image 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * Image image = Image.builder() 025 * .url("{url}") 026 * .dimensions(dimensionsBuilder -> dimensionsBuilder) 027 * .label("{label}") 028 * .build() 029 * </code></pre> 030 * </div> 031 */ 032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 033@JsonDeserialize(as = ImageImpl.class) 034public interface Image { 035 036 /** 037 * 038 * @return url 039 */ 040 @NotNull 041 @JsonProperty("url") 042 public String getUrl(); 043 044 /** 045 * 046 * @return dimensions 047 */ 048 @NotNull 049 @Valid 050 @JsonProperty("dimensions") 051 public ImageDimensions getDimensions(); 052 053 /** 054 * 055 * @return label 056 */ 057 @NotNull 058 @JsonProperty("label") 059 public String getLabel(); 060 061 /** 062 * set url 063 * @param url value to be set 064 */ 065 066 public void setUrl(final String url); 067 068 /** 069 * set dimensions 070 * @param dimensions value to be set 071 */ 072 073 public void setDimensions(final ImageDimensions dimensions); 074 075 /** 076 * set label 077 * @param label value to be set 078 */ 079 080 public void setLabel(final String label); 081 082 /** 083 * factory method 084 * @return instance of Image 085 */ 086 public static Image of() { 087 return new ImageImpl(); 088 } 089 090 /** 091 * factory method to create a shallow copy Image 092 * @param template instance to be copied 093 * @return copy instance 094 */ 095 public static Image of(final Image template) { 096 ImageImpl instance = new ImageImpl(); 097 instance.setUrl(template.getUrl()); 098 instance.setDimensions(template.getDimensions()); 099 instance.setLabel(template.getLabel()); 100 return instance; 101 } 102 103 /** 104 * factory method to create a deep copy of Image 105 * @param template instance to be copied 106 * @return copy instance 107 */ 108 @Nullable 109 public static Image deepCopy(@Nullable final Image template) { 110 if (template == null) { 111 return null; 112 } 113 ImageImpl instance = new ImageImpl(); 114 instance.setUrl(template.getUrl()); 115 instance.setDimensions( 116 com.commercetools.history.models.common.ImageDimensions.deepCopy(template.getDimensions())); 117 instance.setLabel(template.getLabel()); 118 return instance; 119 } 120 121 /** 122 * builder factory method for Image 123 * @return builder 124 */ 125 public static ImageBuilder builder() { 126 return ImageBuilder.of(); 127 } 128 129 /** 130 * create builder for Image instance 131 * @param template instance with prefilled values for the builder 132 * @return builder 133 */ 134 public static ImageBuilder builder(final Image template) { 135 return ImageBuilder.of(template); 136 } 137 138 /** 139 * accessor map function 140 * @param <T> mapped type 141 * @param helper function to map the object 142 * @return mapped value 143 */ 144 default <T> T withImage(Function<Image, T> helper) { 145 return helper.apply(this); 146 } 147 148 /** 149 * gives a TypeReference for usage with Jackson DataBind 150 * @return TypeReference 151 */ 152 public static com.fasterxml.jackson.core.type.TypeReference<Image> typeReference() { 153 return new com.fasterxml.jackson.core.type.TypeReference<Image>() { 154 @Override 155 public String toString() { 156 return "TypeReference<Image>"; 157 } 158 }; 159 } 160}