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.constraints.NotNull; 010 011import com.fasterxml.jackson.annotation.*; 012import com.fasterxml.jackson.databind.annotation.*; 013 014import io.vrap.rmf.base.client.utils.Generated; 015 016/** 017 * GeoLocation 018 * 019 * <hr> 020 * Example to create an instance using the builder pattern 021 * <div class=code-example> 022 * <pre><code class='java'> 023 * GeoLocation geoLocation = GeoLocation.builder() 024 * .type("{type}") 025 * .plusCoordinates(coordinatesBuilder -> coordinatesBuilder) 026 * .build() 027 * </code></pre> 028 * </div> 029 */ 030@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 031@JsonDeserialize(as = GeoLocationImpl.class) 032public interface GeoLocation { 033 034 /** 035 * 036 * @return type 037 */ 038 @NotNull 039 @JsonProperty("type") 040 public String getType(); 041 042 /** 043 * 044 * @return coordinates 045 */ 046 @NotNull 047 @JsonProperty("coordinates") 048 public List<Integer> getCoordinates(); 049 050 /** 051 * set type 052 * @param type value to be set 053 */ 054 055 public void setType(final String type); 056 057 /** 058 * set coordinates 059 * @param coordinates values to be set 060 */ 061 062 @JsonIgnore 063 public void setCoordinates(final Integer... coordinates); 064 065 /** 066 * set coordinates 067 * @param coordinates values to be set 068 */ 069 070 public void setCoordinates(final List<Integer> coordinates); 071 072 /** 073 * factory method 074 * @return instance of GeoLocation 075 */ 076 public static GeoLocation of() { 077 return new GeoLocationImpl(); 078 } 079 080 /** 081 * factory method to create a shallow copy GeoLocation 082 * @param template instance to be copied 083 * @return copy instance 084 */ 085 public static GeoLocation of(final GeoLocation template) { 086 GeoLocationImpl instance = new GeoLocationImpl(); 087 instance.setType(template.getType()); 088 instance.setCoordinates(template.getCoordinates()); 089 return instance; 090 } 091 092 /** 093 * factory method to create a deep copy of GeoLocation 094 * @param template instance to be copied 095 * @return copy instance 096 */ 097 @Nullable 098 public static GeoLocation deepCopy(@Nullable final GeoLocation template) { 099 if (template == null) { 100 return null; 101 } 102 GeoLocationImpl instance = new GeoLocationImpl(); 103 instance.setType(template.getType()); 104 instance.setCoordinates(Optional.ofNullable(template.getCoordinates()).map(ArrayList::new).orElse(null)); 105 return instance; 106 } 107 108 /** 109 * builder factory method for GeoLocation 110 * @return builder 111 */ 112 public static GeoLocationBuilder builder() { 113 return GeoLocationBuilder.of(); 114 } 115 116 /** 117 * create builder for GeoLocation instance 118 * @param template instance with prefilled values for the builder 119 * @return builder 120 */ 121 public static GeoLocationBuilder builder(final GeoLocation template) { 122 return GeoLocationBuilder.of(template); 123 } 124 125 /** 126 * accessor map function 127 * @param <T> mapped type 128 * @param helper function to map the object 129 * @return mapped value 130 */ 131 default <T> T withGeoLocation(Function<GeoLocation, T> helper) { 132 return helper.apply(this); 133 } 134 135 /** 136 * gives a TypeReference for usage with Jackson DataBind 137 * @return TypeReference 138 */ 139 public static com.fasterxml.jackson.core.type.TypeReference<GeoLocation> typeReference() { 140 return new com.fasterxml.jackson.core.type.TypeReference<GeoLocation>() { 141 @Override 142 public String toString() { 143 return "TypeReference<GeoLocation>"; 144 } 145 }; 146 } 147}