├── .gitignore ├── LICENSE ├── README.md ├── pom.xml └── src ├── main └── java │ └── com │ └── metamx │ └── datatypes │ ├── ExampleMain.java │ ├── ExampleWriteNewLineJson.java │ ├── mmx │ ├── MmxAuctionSummary.java │ ├── MmxBid.java │ ├── MmxBidResponse.java │ ├── MmxClick.java │ ├── MmxImpDelivery.java │ └── MmxSeatBid.java │ ├── openrtb │ ├── App.java │ ├── Banner.java │ ├── Bid.java │ ├── BidRequest.java │ ├── BidResponse.java │ ├── Content.java │ ├── Data.java │ ├── Deals.java │ ├── Device.java │ ├── Ext.java │ ├── Geo.java │ ├── Imp.java │ ├── Native.java │ ├── Pmp.java │ ├── Producer.java │ ├── Publisher.java │ ├── Regs.java │ ├── SeatBid.java │ ├── Segment.java │ ├── Site.java │ ├── User.java │ └── Video.java │ └── openrtbnative │ ├── AssetRequest.java │ ├── AssetResponse.java │ ├── DataRequest.java │ ├── DataResponse.java │ ├── ImageRequest.java │ ├── ImageResponse.java │ ├── Link.java │ ├── NativeAdCreative.java │ ├── NativeRequest.java │ ├── NativeResponse.java │ ├── TitleRequest.java │ ├── TitleResponse.java │ ├── VideoRequest.java │ └── VideoResponse.java └── test └── java └── com └── metamx └── datatypes ├── mmx ├── AuctionSummaryTest.java ├── DealsTest.java └── WriteNewLinesTest.java ├── openrtb ├── BidRequestTest.java └── BidResponseTest.java └── openrtbnative ├── NativeRequestTest.java └── NativeResponseTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.ipr 2 | *.iws 3 | *.iml 4 | target 5 | dist 6 | *.jar 7 | *.tar 8 | *.zip 9 | *.iml 10 | *.ipr 11 | .idea 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Metamarkets Group Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RadTech Datatypes 2 | 3 | Rad-Tech-Datatypes is a Java library built to assist in the serialization & validation of JSON event records designed for the reporting use cases of programmatic media markets. 4 | 5 | These records are further outlined in the [Metamarkets Real-time Data Ingestion (RDI) API documentation](https://metamarkets.com/what-we-do/docs/formatting-openrtb-exchangessp-data/), and are based on the protocol defined by the [OpenRTB API Specification](http://www.iab.net/guidelines/rtbproject). 6 | 7 | ## JARs 8 | 9 | Rad-Tech-Datatypes artifacts are hosted on the Metamarkets maven repository: https://metamx.artifactoryonline.com/metamx/pub-libs-releases-local/. 10 | If you set up your project to know about this repository, you can depend on one of the hosted versions. 11 | 12 | While there is not yet a stable release, the current version in beta testing is: 13 | ```xml 14 | 15 | com.metamx 16 | rad-tech-datatypes 17 | 0.0.7 18 | 19 | ``` 20 | ## Usage 21 | 22 | ### Jackson 23 | 24 | Rad-Tech-Datatypes uses the Jackson data-binding API, so we start by creating a `com.fasterxml.jackson.databind.ObjectMapper` instance: 25 | ```java 26 | final ObjectMapper objectMapper = new ObjectMapper(); 27 | ``` 28 | *Note*: Avoid using `jackson` version `2.6.x`, as this version of the `annotations` API leads to unintend runtime errors. For more info, please refer to the [javadoc for the JsonInclude enum.](https://github.com/FasterXML/jackson-annotations/blob/master/src/main/java/com/fasterxml/jackson/annotation/JsonInclude.java#L154-L165) Versions `2.2.x` - `2.5.x` and `2.7.x` or greater run as expected. 29 | 30 | ### Serialization 31 | The MMX Auction Summary record consists of an OpenRTB bid request with an array of nested OpenRTB bid responses. Additional parameters for denoting information about the auction and bids have been added where applicable. 32 | ```java 33 | // Build the Auction Summary record 34 | final MmxAuctionSummary auctionSummary = MmxAuctionSummary 35 | .builder() 36 | .timestamp(new DateTime("2014-01-01T00:00:00.000Z")) 37 | .auctionType(2) 38 | .bcat(Arrays.asList("IAB26", "IAB25")) 39 | .requestId("AFEWSEBD5EB5FI32DASFCD452BB78DVE") 40 | .app( 41 | App.builder() 42 | .bundle("bundlename") 43 | .cat(Arrays.asList("IAB1")) 44 | .domain("unicornssay.com") 45 | .id("12312312") 46 | .name("Unicornssay") 47 | .publisher( 48 | Publisher.builder().id("DSA1394D42D3").name("Unicornssay").build() 49 | ).build() 50 | ).site( 51 | Site.builder() 52 | .cat(Arrays.asList("IAB1", "IAB2")) 53 | .domain("unicornssay.com") 54 | .id("1345135123") 55 | .name("Unicornssay") 56 | .publisher( 57 | Publisher.builder().id("pub12345").name("Publisher A").build() 58 | ).build() 59 | ).impressions( 60 | Arrays.asList( 61 | Imp.builder().tagId("231").bidFloor(0.1).secure(0).banner( 62 | Banner.builder().height(320).width(50).pos(3).apiFrameworks(Arrays.asList(3, 4)).build() 63 | ).displayManager("MyRenderer").displayManagerVer("v2").build() 64 | ) 65 | ).device( 66 | Device.builder() 67 | .carrier("Verizon") 68 | .connectionType(2) 69 | .deviceType(1) 70 | .didmd5("AA003") 71 | .didsha1("AA023") 72 | .dnt(0) 73 | .dpidmd5("A400FABFB5") 74 | .dpidsha1("AA0") 75 | .flashVer("2.1") 76 | .ifa("123") 77 | .ip("192.168.1.8") 78 | .jsSupport(1) 79 | .language("en") 80 | .macsha1("E50BB11") 81 | .macmd5("BB11") 82 | .make("Apple") 83 | .model("iPhone 3GS") 84 | .osVer("4.2.1") 85 | .os("iOS") 86 | .ua("Crazy UA String!") 87 | .geo( 88 | Geo.builder() 89 | .city("US-SFO") 90 | .country("USA") 91 | .lat(37.790148) 92 | .lon(-122.434103) 93 | .metro("807") 94 | .region("CA") 95 | .type(1) 96 | .zip("94107") 97 | .build() 98 | ).build() 99 | ).user( 100 | User.builder().id("456789876567897654678987656789").yob(1987).gender("M").data( 101 | Arrays.asList( 102 | Data.builder().id("123").name("bluesky").segment( 103 | Arrays.asList( 104 | Segment.builder().id("abc1").name("gender").value("male").build() 105 | ) 106 | ).build() 107 | ) 108 | ).build() 109 | ).responses( 110 | Arrays.asList( 111 | MmxBidResponse.builder() 112 | .timestamp(new DateTime("2014-03-05T04:58:23.200Z")) 113 | .status(1) 114 | .totalDuration(43L) 115 | .bidderId("1921") 116 | .bidderName("RealAds") 117 | .cur("USD") 118 | .seatBid( 119 | Arrays.asList( 120 | MmxSeatBid.builder() 121 | .seat("512") 122 | .bid( 123 | Arrays.asList( 124 | MmxBid.builder() 125 | .id("1") 126 | .impId("102") 127 | .status(1) 128 | .price(5.43) 129 | .clearPrice(1.1) 130 | .adId("314") 131 | .attr(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 12)) 132 | .crId("1234") 133 | .cId("229") 134 | .adomain(Arrays.asList("realtime4real.mmx.org")) 135 | .build() 136 | ) 137 | ).build() 138 | ) 139 | ).build() 140 | ) 141 | ).build(); 142 | 143 | ``` 144 | Custom JSON can be added to all objects via an extension object. Supported types include `String`, `Integer`, `Double` and `List`s of `String`s. 145 | ```java 146 | final ObjectMapper objectMapper = new ObjectMapper(); 147 | final MmxAuctionSummary auctionSummary = MmxAuctionSummary 148 | .builder() 149 | .timestamp(new DateTime("2014-01-01T00:00:00.000Z")) 150 | .requestId("AFEWSEBD5EB5FI32DASFCD452BB78DVE") 151 | .ext( 152 | Ext.builder().put("custFlag", 3).put("custStr", "Unicorns are the best!").build() 153 | ) 154 | ``` 155 | 156 | ### Uploading Data to Metamarkets Real-time Data Ingestion 157 | 158 | Data uploaded to RDI consists of newline separated JSON records posted continuously to an HTTPS endpoint. Here is an example illustrating how Rad-Tech-Datatypes can be applied to do so. 159 | ```java 160 | import com.fasterxml.jackson.databind.DeserializationFeature; 161 | import com.fasterxml.jackson.databind.ObjectMapper; 162 | import com.metamx.datatypes.mmx.MmxAuctionSummary; 163 | import org.joda.time.DateTime; 164 | import java.io.ByteArrayOutputStream; 165 | import java.io.OutputStream; 166 | import java.util.Arrays; 167 | import java.util.List; 168 | 169 | public class ExampleWriteNewLineJson 170 | { 171 | public static void main(String[] args) throws Exception 172 | { 173 | final MmxAuctionSummary sampleAuction1 = MmxAuctionSummary 174 | .builder() 175 | .timestamp(new DateTime("2014-01-01T00:00:00.000Z")).auctionType(2).build(); 176 | final MmxAuctionSummary sampleAuction2 = MmxAuctionSummary 177 | .builder() 178 | .timestamp(new DateTime("2014-01-01T01:00:00.000Z")).auctionType(1).build(); 179 | 180 | List auctionList = Arrays.asList(sampleAuction1, sampleAuction2); 181 | final String separator = "\n"; 182 | 183 | final ObjectMapper objectMapper = new ObjectMapper(); 184 | objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); 185 | final OutputStream outStream = new ByteArrayOutputStream(); 186 | 187 | for (MmxAuctionSummary auction : auctionList) { 188 | outStream.write(objectMapper.writeValueAsBytes(auction)); 189 | outStream.write(separator.getBytes()); 190 | } 191 | 192 | System.out.println(outStream.toString()); 193 | } 194 | } 195 | ``` 196 | Note: RDI users are encouraged to use GZIP compression. 197 | 198 | For more information on posting data to RDI, click [here](http://metamx.github.io/docs.metamarkets.com/docs/latest/rdiclient). 199 | 200 | 201 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | com.metamx 5 | rad-tech-datatypes 6 | 0.0.7-SNAPSHOT 7 | rad-tech-datatypes 8 | Metamarkets data types 9 | 10 | scm:git:ssh://git@github.com/metamx/rad-tech-datatypes.git 11 | scm:git:ssh://git@github.com/metamx/rad-tech-datatypes.git 12 | http://www.github.com/metamx/rad-tech-datatypes 13 | HEAD 14 | 15 | 16 | 17 | UTF-8 18 | 2.2.2 19 | 20 | 21 | 22 | 23 | joda-time 24 | joda-time 25 | 2.2 26 | 27 | 28 | com.fasterxml.jackson.core 29 | jackson-annotations 30 | ${jackson.version} 31 | 32 | 33 | com.fasterxml.jackson.core 34 | jackson-core 35 | ${jackson.version} 36 | 37 | 38 | com.fasterxml.jackson.core 39 | jackson-databind 40 | ${jackson.version} 41 | 42 | 43 | 44 | 45 | junit 46 | junit 47 | 4.8.1 48 | test 49 | 50 | 51 | 52 | 53 | 54 | 55 | maven-compiler-plugin 56 | 2.5.1 57 | 58 | 1.6 59 | 1.6 60 | 61 | 62 | 63 | maven-jar-plugin 64 | 2.4 65 | 66 | 67 | org.apache.maven.plugins 68 | maven-release-plugin 69 | 2.4.2 70 | 71 | 72 | org.apache.maven.scm 73 | maven-scm-provider-gitexe 74 | 1.8.1 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | central-local 84 | Metamarkets Local 85 | https://metamx.artifactoryonline.com/metamx/pub-libs-releases-local 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/ExampleMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes; 19 | 20 | import com.fasterxml.jackson.databind.ObjectMapper; 21 | import com.metamx.datatypes.mmx.MmxBid; 22 | import com.metamx.datatypes.mmx.MmxSeatBid; 23 | import com.metamx.datatypes.mmx.MmxAuctionSummary; 24 | import com.metamx.datatypes.mmx.MmxBidResponse; 25 | import com.metamx.datatypes.openrtb.App; 26 | import com.metamx.datatypes.openrtb.Banner; 27 | import com.metamx.datatypes.openrtb.Data; 28 | import com.metamx.datatypes.openrtb.Device; 29 | import com.metamx.datatypes.openrtb.Ext; 30 | import com.metamx.datatypes.openrtb.Geo; 31 | import com.metamx.datatypes.openrtb.Imp; 32 | import com.metamx.datatypes.openrtb.Publisher; 33 | import com.metamx.datatypes.openrtb.Segment; 34 | import com.metamx.datatypes.openrtb.Site; 35 | import com.metamx.datatypes.openrtb.User; 36 | import org.joda.time.DateTime; 37 | 38 | import java.util.Arrays; 39 | 40 | public class ExampleMain 41 | { 42 | public static void main(String[] args) throws Exception 43 | { 44 | final ObjectMapper objectMapper = new ObjectMapper(); 45 | final MmxAuctionSummary auctionSummary = MmxAuctionSummary 46 | .builder() 47 | .timestamp(new DateTime("2014-01-01T00:00:00.000Z")) 48 | .auctionType(2) 49 | .bcat(Arrays.asList("IAB26", "IAB25")) 50 | .requestId("AFEWSEBD5EB5FI32DASFCD452BB78DVE") 51 | .ext( 52 | Ext.builder().put("custFlag",3).put("custStr","Unicorns are the best!").build() 53 | ).app( 54 | App.builder() 55 | .bundle("bundlename") 56 | .cat(Arrays.asList("IAB1")) 57 | .domain("unicornssay.com") 58 | .id("12312312") 59 | .name("Unicornssay") 60 | .publisher( 61 | Publisher.builder().id("DSA1394D42D3").name("Unicornssay").build() 62 | ).build() 63 | ).site( 64 | Site.builder() 65 | .cat(Arrays.asList("IAB1", "IAB2")) 66 | .domain("unicornssay.com") 67 | .id("1345135123") 68 | .name("Unicornssay") 69 | .publisher( 70 | Publisher.builder().id("pub12345").name("Publisher A").build() 71 | ).build() 72 | ).impressions( 73 | Arrays.asList( 74 | Imp.builder().tagId("231").bidFloor(0.1).secure(0).banner( 75 | Banner.builder().height(320).width(50).pos(3).api(Arrays.asList(3, 4)).build() 76 | ).displayManager("MyRenderer").displayManagerVer("v2").build() 77 | ) 78 | ).device( 79 | Device.builder() 80 | .carrier("Verizon") 81 | .connectionType(2) 82 | .deviceType(1) 83 | .didmd5("AA003") 84 | .didsha1("AA023") 85 | .dnt(0) 86 | .dpidmd5("A400FABFB5") 87 | .dpidsha1("AA0") 88 | .flashVer("2.1") 89 | .ifa("123") 90 | .ip("192.168.1.8") 91 | .jsSupport(1) 92 | .language("en") 93 | .macsha1("E50BB11") 94 | .macmd5("BB11") 95 | .make("Apple") 96 | .model("iPhone 3GS") 97 | .osVer("4.2.1") 98 | .os("iOS") 99 | .ua("Crazy UA String!") 100 | .geo( 101 | Geo.builder() 102 | .city("US-SFO") 103 | .country("USA") 104 | .lat(37.790148) 105 | .lon(-122.434103) 106 | .metro("807") 107 | .region("CA") 108 | .type(1) 109 | .zip("94107") 110 | .build() 111 | ).ext( 112 | Ext.builder().put("customField", "sam").build() 113 | ).build() 114 | ).user( 115 | User.builder().id("456789876567897654678987656789").yob(1987).gender("M").data( 116 | Arrays.asList( 117 | Data.builder().id("123").name("bluesky").segment( 118 | Arrays.asList( 119 | Segment.builder().id("abc1").name("gender").value("male").build() 120 | ) 121 | ).build() 122 | ) 123 | ).build() 124 | ).responses( 125 | Arrays.asList( 126 | MmxBidResponse.builder() 127 | .timestamp(new DateTime("2014-03-05T04:58:23.200Z")) 128 | .status(1) 129 | .totalDuration(43L) 130 | .bidderId("1921") 131 | .bidderName("RealAds") 132 | .cur("USD") 133 | .seatBid( 134 | Arrays.asList( 135 | MmxSeatBid.builder() 136 | .seat("512") 137 | .bid( 138 | Arrays.asList( 139 | MmxBid.builder() 140 | .id("1") 141 | .impId("102") 142 | .status(1) 143 | .price(5.43) 144 | .clearPrice(1.1) 145 | .adId("314") 146 | .attr(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 12)) 147 | .crId("1234") 148 | .cId("229") 149 | .adomain(Arrays.asList("realtime4real.mmx.org")) 150 | .iUrl("http://adserver.com/pathtosampleimage") 151 | .build() 152 | ) 153 | ).build() 154 | ) 155 | ).build() 156 | ) 157 | ).build(); 158 | System.out.println(objectMapper.writeValueAsString(auctionSummary)); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/ExampleWriteNewLineJson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes; 19 | 20 | import com.fasterxml.jackson.databind.DeserializationFeature; 21 | import com.fasterxml.jackson.databind.ObjectMapper; 22 | import com.metamx.datatypes.mmx.MmxAuctionSummary; 23 | import org.joda.time.DateTime; 24 | import java.io.ByteArrayOutputStream; 25 | import java.io.OutputStream; 26 | import java.util.Arrays; 27 | import java.util.List; 28 | 29 | public class ExampleWriteNewLineJson 30 | { 31 | public static void main(String[] args) throws Exception 32 | { 33 | final MmxAuctionSummary sampleAuction1 = MmxAuctionSummary 34 | .builder() 35 | .timestamp(new DateTime("2014-01-01T00:00:00.000Z")).auctionType(2).build(); 36 | final MmxAuctionSummary sampleAuction2 = MmxAuctionSummary 37 | .builder() 38 | .timestamp(new DateTime("2014-01-01T01:00:00.000Z")).auctionType(1).build(); 39 | 40 | List auctionList = Arrays.asList(sampleAuction1, sampleAuction2); 41 | final String separator = "\n"; 42 | 43 | final ObjectMapper objectMapper = new ObjectMapper(); 44 | objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); 45 | final OutputStream outStream = new ByteArrayOutputStream(); 46 | 47 | for (MmxAuctionSummary auction : auctionList) { 48 | outStream.write(objectMapper.writeValueAsBytes(auction)); 49 | outStream.write(separator.getBytes()); 50 | } 51 | System.out.println(outStream.toString()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/mmx/MmxAuctionSummary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.mmx; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 23 | import com.metamx.datatypes.openrtb.App; 24 | import com.metamx.datatypes.openrtb.Device; 25 | import com.metamx.datatypes.openrtb.Ext; 26 | import com.metamx.datatypes.openrtb.Imp; 27 | import com.metamx.datatypes.openrtb.Regs; 28 | import com.metamx.datatypes.openrtb.Site; 29 | import com.metamx.datatypes.openrtb.User; 30 | import org.joda.time.DateTime; 31 | import org.joda.time.DateTimeZone; 32 | 33 | import java.util.List; 34 | 35 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 36 | public class MmxAuctionSummary 37 | { 38 | private final String timestamp; 39 | private final String requestId; 40 | private final String supplySourceId; 41 | private final String supplySourceName; 42 | private final Integer auctionType; 43 | private final List bcat; 44 | private final List badv; 45 | private final List impressions; 46 | private final App app; 47 | private final Site site; 48 | private final Device device; 49 | private final User user; 50 | private final Integer test; 51 | private final List responses; 52 | private final Regs regs; 53 | private final Ext ext; 54 | 55 | public MmxAuctionSummary( 56 | @JsonProperty("timestamp") String timestamp, 57 | @JsonProperty("id") String requestId, 58 | @JsonProperty("sourceid") String supplySourceId, 59 | @JsonProperty("sourcename") String supplySourceName, 60 | @JsonProperty("at") Integer auctionType, 61 | @JsonProperty("bcat") List bcat, 62 | @JsonProperty("badv") List badv, 63 | @JsonProperty("imp") List impressions, 64 | @JsonProperty("app") App app, 65 | @JsonProperty("site") Site site, 66 | @JsonProperty("device") Device device, 67 | @JsonProperty("user") User user, 68 | @JsonProperty("test") Integer test, 69 | @JsonProperty("bid_responses") List responses, 70 | @JsonProperty("regs") Regs regs, 71 | @JsonProperty("ext") Ext ext 72 | ) 73 | { 74 | this.timestamp = timestamp; 75 | this.requestId = requestId; 76 | this.supplySourceId = supplySourceId; 77 | this.supplySourceName = supplySourceName; 78 | this.auctionType = auctionType; 79 | this.bcat = bcat; 80 | this.badv = badv; 81 | this.impressions = impressions; 82 | this.app = app; 83 | this.site = site; 84 | this.device = device; 85 | this.user = user; 86 | this.test = test; 87 | this.responses = responses; 88 | this.regs = regs; 89 | this.ext = ext; 90 | } 91 | 92 | @JsonProperty 93 | public String getTimestamp() 94 | { 95 | return timestamp; 96 | } 97 | 98 | @JsonProperty("id") 99 | public String getRequestId() 100 | { 101 | return requestId; 102 | } 103 | 104 | @JsonProperty("sourceid") 105 | public String getSupplySourceId() 106 | { 107 | return supplySourceId; 108 | } 109 | 110 | @JsonProperty("sourcename") 111 | public String getSupplySourceName() 112 | { 113 | return supplySourceName; 114 | } 115 | 116 | @JsonProperty("at") 117 | public Integer getAuctionType() 118 | { 119 | return auctionType; 120 | } 121 | 122 | @JsonProperty 123 | public List getBcat() 124 | { 125 | return bcat; 126 | } 127 | 128 | @JsonProperty 129 | public List getBadv() 130 | { 131 | return badv; 132 | } 133 | 134 | @JsonProperty("imp") 135 | public List getImpressions() 136 | { 137 | return impressions; 138 | } 139 | 140 | @JsonProperty 141 | public App getApp() 142 | { 143 | return app; 144 | } 145 | 146 | @JsonProperty 147 | public Site getSite() 148 | { 149 | return site; 150 | } 151 | 152 | @JsonProperty 153 | public Device getDevice() 154 | { 155 | return device; 156 | } 157 | 158 | @JsonProperty 159 | public User getUser() 160 | { 161 | return user; 162 | } 163 | 164 | @JsonProperty 165 | public Integer getTest() 166 | { 167 | return test; 168 | } 169 | 170 | @JsonProperty("bid_responses") 171 | public List getResponses() 172 | { 173 | return responses; 174 | } 175 | 176 | @JsonProperty 177 | public Regs getRegs() 178 | { 179 | return regs; 180 | } 181 | 182 | @JsonProperty 183 | public Ext getExt() 184 | { 185 | return ext; 186 | } 187 | 188 | 189 | public static Builder builder() 190 | { 191 | return new Builder(); 192 | } 193 | 194 | public static class Builder 195 | { 196 | private DateTime timestamp; 197 | private String requestId; 198 | private String supplySourceId; 199 | private String supplySourceName; 200 | private Integer auctionType; 201 | private List bcat; 202 | private List badv; 203 | private List impressions; 204 | private App app; 205 | private Site site; 206 | private Device device; 207 | private User user; 208 | private Integer test; 209 | private List responses; 210 | private Regs regs; 211 | private Ext ext; 212 | 213 | public Builder() {} 214 | 215 | public Builder timestamp(final DateTime timestamp) 216 | { 217 | this.timestamp = timestamp; 218 | return this; 219 | } 220 | 221 | public Builder requestId(final String requestId) 222 | { 223 | this.requestId = requestId; 224 | return this; 225 | } 226 | 227 | public Builder supplySourceId(final String supplySourceId) 228 | { 229 | this.supplySourceId = supplySourceId; 230 | return this; 231 | } 232 | 233 | public Builder supplySourceName(final String supplySourceName) 234 | { 235 | this.supplySourceName = supplySourceName; 236 | return this; 237 | } 238 | 239 | public Builder auctionType(final Integer auctionType) 240 | { 241 | this.auctionType = auctionType; 242 | return this; 243 | } 244 | 245 | public Builder bcat(final List bcat) 246 | { 247 | this.bcat = bcat; 248 | return this; 249 | } 250 | 251 | public Builder badv(final List badv) 252 | { 253 | this.badv = badv; 254 | return this; 255 | } 256 | 257 | public Builder regs(final Regs regs) 258 | { 259 | this.regs = regs; 260 | return this; 261 | } 262 | 263 | public Builder impressions(final List impressions) 264 | { 265 | this.impressions = impressions; 266 | return this; 267 | } 268 | 269 | public Builder app(final App app) 270 | { 271 | this.app = app; 272 | return this; 273 | } 274 | 275 | public Builder site(final Site site) 276 | { 277 | this.site = site; 278 | return this; 279 | } 280 | 281 | public Builder device(final Device device) 282 | { 283 | this.device = device; 284 | return this; 285 | } 286 | 287 | public Builder user(final User user) 288 | { 289 | this.user = user; 290 | return this; 291 | } 292 | 293 | public Builder test(final Integer test) 294 | { 295 | this.test = test; 296 | return this; 297 | } 298 | 299 | public Builder responses(final List responses) 300 | { 301 | this.responses = responses; 302 | return this; 303 | } 304 | 305 | public Builder ext(final Ext ext) 306 | { 307 | this.ext = ext; 308 | return this; 309 | } 310 | 311 | public MmxAuctionSummary build() 312 | { 313 | if (timestamp == null) { 314 | throw new NullPointerException("null timestamp"); 315 | } 316 | return new MmxAuctionSummary( 317 | timestamp.withZone(DateTimeZone.UTC).toString(), 318 | requestId, 319 | supplySourceId, 320 | supplySourceName, 321 | auctionType, 322 | bcat, 323 | badv, 324 | impressions, 325 | app, 326 | site, 327 | device, 328 | user, 329 | test, 330 | responses, 331 | regs, 332 | ext 333 | ); 334 | } 335 | } 336 | } 337 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/mmx/MmxBid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.mmx; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | import java.util.List; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class MmxBid 28 | { 29 | private final String id; 30 | private final String impId; 31 | private final Integer status; 32 | private final Double price; 33 | private final Double clearPrice; 34 | private final String adId; 35 | private final String nurl; 36 | private final String adm; 37 | private final List adomain; 38 | private final String bundle; 39 | private final String iUrl; 40 | private final String cId; 41 | private final String crId; 42 | private final String cat; 43 | private final List attr; 44 | private final String dealId; 45 | private final Integer height; 46 | private final Integer width; 47 | private final Ext ext; 48 | 49 | public MmxBid( 50 | @JsonProperty("id") String id, 51 | @JsonProperty("impid") String impId, 52 | @JsonProperty("status") Integer status, 53 | @JsonProperty("price") Double price, 54 | @JsonProperty("clear_price") Double clearPrice, 55 | @JsonProperty("adid") String adId, 56 | @JsonProperty("nurl") String nurl, 57 | @JsonProperty("adm") String adm, 58 | @JsonProperty("adomain") List adomain, 59 | @JsonProperty("bundle") String bundle, 60 | @JsonProperty("iurl") String iUrl, 61 | @JsonProperty("cid") String cId, 62 | @JsonProperty("crid") String crId, 63 | @JsonProperty("cat") String cat, 64 | @JsonProperty("attr") List attr, 65 | @JsonProperty("dealid") String dealId, 66 | @JsonProperty("h") Integer height, 67 | @JsonProperty("w") Integer width, 68 | @JsonProperty("ext") Ext ext 69 | ) 70 | { 71 | this.id = id; 72 | this.impId = impId; 73 | this.status = status; 74 | this.price = price; 75 | this.clearPrice = clearPrice; 76 | this.adId = adId; 77 | this.nurl = nurl; 78 | this.adm = adm; 79 | this.adomain = adomain; 80 | this.bundle = bundle; 81 | this.iUrl = iUrl; 82 | this.cId = cId; 83 | this.crId = crId; 84 | this.cat = cat; 85 | this.attr = attr; 86 | this.dealId = dealId; 87 | this.height = height; 88 | this.width = width; 89 | this.ext = ext; 90 | } 91 | 92 | @JsonProperty 93 | public String getId() 94 | { 95 | return id; 96 | } 97 | 98 | @JsonProperty("impid") 99 | public String getImpId() 100 | { 101 | return impId; 102 | } 103 | 104 | @JsonProperty 105 | public Integer getStatus() 106 | { 107 | return status; 108 | } 109 | 110 | @JsonProperty 111 | public Double getPrice() 112 | { 113 | return price; 114 | } 115 | 116 | @JsonProperty("clear_price") 117 | public Double getClearPrice() 118 | { 119 | return clearPrice; 120 | } 121 | 122 | @JsonProperty("adid") 123 | public String getAdId() 124 | { 125 | return adId; 126 | } 127 | 128 | @JsonProperty 129 | public String getNurl() 130 | { 131 | return nurl; 132 | } 133 | 134 | @JsonProperty 135 | public String getAdm() 136 | { 137 | return adm; 138 | } 139 | 140 | @JsonProperty 141 | public List getAdomain() 142 | { 143 | return adomain; 144 | } 145 | 146 | @JsonProperty 147 | public String getBundle() 148 | { 149 | return bundle; 150 | } 151 | 152 | @JsonProperty("iurl") 153 | public String getiUrl() 154 | { 155 | return iUrl; 156 | } 157 | 158 | @JsonProperty("cid") 159 | public String getcId() 160 | { 161 | return cId; 162 | } 163 | 164 | @JsonProperty("crid") 165 | public String getCrId() 166 | { 167 | return crId; 168 | } 169 | 170 | @JsonProperty 171 | public String getCat() 172 | { 173 | return cat; 174 | } 175 | 176 | @JsonProperty 177 | public List getAttr() 178 | { 179 | return attr; 180 | } 181 | 182 | @JsonProperty("dealid") 183 | public String getDealId() 184 | { 185 | return dealId; 186 | } 187 | 188 | @JsonProperty("h") 189 | public Integer getHeight() 190 | { 191 | return height; 192 | } 193 | 194 | @JsonProperty("w") 195 | public Integer getWidth() 196 | { 197 | return width; 198 | } 199 | 200 | @JsonProperty 201 | public Ext getExt() 202 | { 203 | return ext; 204 | } 205 | 206 | public static Builder builder() 207 | { 208 | return new Builder(); 209 | } 210 | 211 | public static class Builder 212 | { 213 | private String id; 214 | private String impId; 215 | private Integer status; 216 | private Double price; 217 | private Double clearPrice; 218 | private String adId; 219 | private String nurl; 220 | private String adm; 221 | private List adomain; 222 | private String bundle; 223 | private String iUrl; 224 | private String cId; 225 | private String crId; 226 | private String cat; 227 | private List attr; 228 | private String dealId; 229 | private Integer height; 230 | private Integer width; 231 | private Ext ext; 232 | 233 | public Builder() {} 234 | 235 | public Builder id(final String id) 236 | { 237 | this.id = id; 238 | return this; 239 | } 240 | 241 | public Builder impId(final String impId) 242 | { 243 | this.impId = impId; 244 | return this; 245 | } 246 | 247 | public Builder status(final Integer status) 248 | { 249 | this.status = status; 250 | return this; 251 | } 252 | 253 | public Builder price(final Double price) 254 | { 255 | this.price = price; 256 | return this; 257 | } 258 | 259 | public Builder clearPrice(final Double clearPrice) 260 | { 261 | this.clearPrice = clearPrice; 262 | return this; 263 | } 264 | 265 | public Builder adId(final String adId) 266 | { 267 | this.adId = adId; 268 | return this; 269 | } 270 | 271 | public Builder nurl(final String nurl) 272 | { 273 | this.nurl = nurl; 274 | return this; 275 | } 276 | 277 | public Builder adm(final String adm) 278 | { 279 | this.adm = adm; 280 | return this; 281 | } 282 | 283 | public Builder adomain(final List adomain) 284 | { 285 | this.adomain = adomain; 286 | return this; 287 | } 288 | 289 | public Builder bundle(final String bundle) 290 | { 291 | this.bundle = bundle; 292 | return this; 293 | } 294 | 295 | public Builder iUrl(final String iUrl) 296 | { 297 | this.iUrl = iUrl; 298 | return this; 299 | } 300 | 301 | public Builder cId(final String cId) 302 | { 303 | this.cId = cId; 304 | return this; 305 | } 306 | 307 | public Builder crId(final String crId) 308 | { 309 | this.crId = crId; 310 | return this; 311 | } 312 | 313 | public Builder cat(final String cat) 314 | { 315 | this.cat = cat; 316 | return this; 317 | } 318 | 319 | public Builder attr(final List attr) 320 | { 321 | this.attr = attr; 322 | return this; 323 | } 324 | 325 | public Builder dealId(final String dealId) 326 | { 327 | this.dealId = dealId; 328 | return this; 329 | } 330 | 331 | public Builder height(final Integer height) 332 | { 333 | this.height = height; 334 | return this; 335 | } 336 | 337 | public Builder width(final Integer width) 338 | { 339 | this.width = width; 340 | return this; 341 | } 342 | 343 | public Builder ext(final Ext ext) 344 | { 345 | this.ext = ext; 346 | return this; 347 | } 348 | 349 | 350 | public MmxBid build() 351 | { 352 | return new MmxBid( 353 | id, 354 | impId, 355 | status, 356 | price, 357 | clearPrice, 358 | adId, 359 | nurl, 360 | adm, 361 | adomain, 362 | bundle, 363 | iUrl, 364 | cId, 365 | crId, 366 | cat, 367 | attr, 368 | dealId, 369 | height, 370 | width, 371 | ext 372 | ); 373 | } 374 | } 375 | } 376 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/mmx/MmxBidResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.mmx; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | import org.joda.time.DateTime; 24 | import org.joda.time.DateTimeZone; 25 | 26 | import java.util.List; 27 | 28 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 29 | public class MmxBidResponse 30 | { 31 | private final String timestamp; 32 | private final Integer status; 33 | private final Long totalDuration; 34 | private final String bidderId; 35 | private final String bidderName; 36 | private final String cur; 37 | private final List seatBid; 38 | private final String bidId; 39 | private final Integer nbr; 40 | private final Ext ext; 41 | 42 | public MmxBidResponse( 43 | @JsonProperty("timestamp") String timestamp, 44 | @JsonProperty("bidder_id") String bidderId, 45 | @JsonProperty("bidder_name") String bidderName, 46 | @JsonProperty("status") Integer status, 47 | @JsonProperty("total_duration") Long totalDuration, 48 | @JsonProperty("seatbid") List seatBid, 49 | @JsonProperty("bidid") String bidId, 50 | @JsonProperty("cur") String cur, 51 | @JsonProperty("nbr") Integer nbr, 52 | @JsonProperty("ext") Ext ext 53 | ) 54 | { 55 | this.timestamp = timestamp; 56 | this.status = status; 57 | this.totalDuration = totalDuration; 58 | this.bidderId = bidderId; 59 | this.bidderName = bidderName; 60 | this.seatBid = seatBid; 61 | this.bidId = bidId; 62 | this.cur = cur; 63 | this.nbr = nbr; 64 | this.ext = ext; 65 | } 66 | 67 | @JsonProperty 68 | public String getTimestamp() 69 | { 70 | return timestamp; 71 | } 72 | 73 | @JsonProperty 74 | public Integer getStatus() 75 | { 76 | return status; 77 | } 78 | 79 | @JsonProperty("total_duration") 80 | public Long getTotalDuration() 81 | { 82 | return totalDuration; 83 | } 84 | 85 | @JsonProperty("bidder_id") 86 | public String getBidderId() 87 | { 88 | return bidderId; 89 | } 90 | 91 | @JsonProperty("bidder_name") 92 | public String getBidderName() 93 | { 94 | return bidderName; 95 | } 96 | 97 | @JsonProperty("seatbid") 98 | public List getSeatBid() 99 | { 100 | return seatBid; 101 | } 102 | 103 | @JsonProperty("bidid") 104 | public String getBidId() 105 | { 106 | return bidId; 107 | } 108 | 109 | @JsonProperty 110 | public String getCur() 111 | { 112 | return cur; 113 | } 114 | 115 | @JsonProperty 116 | public Integer getNbr() 117 | { 118 | return nbr; 119 | } 120 | 121 | @JsonProperty 122 | public Ext getExt() 123 | { 124 | return ext; 125 | } 126 | 127 | public static Builder builder() 128 | { 129 | return new Builder(); 130 | } 131 | 132 | public static class Builder 133 | { 134 | private DateTime timestamp; 135 | private Integer status; 136 | private Long totalDuration; 137 | private String bidderId; 138 | private String bidderName; 139 | private List seatBid; 140 | private String bidId; 141 | private String cur; 142 | private Integer nbr; 143 | private Ext ext; 144 | 145 | public Builder() {} 146 | 147 | public Builder timestamp(final DateTime timestamp) 148 | { 149 | this.timestamp = timestamp; 150 | return this; 151 | } 152 | 153 | public Builder status(final Integer status) 154 | { 155 | this.status = status; 156 | return this; 157 | } 158 | 159 | public Builder totalDuration(final Long totalDuration) 160 | { 161 | this.totalDuration = totalDuration; 162 | return this; 163 | } 164 | 165 | public Builder bidderId(final String bidderId) 166 | { 167 | this.bidderId = bidderId; 168 | return this; 169 | } 170 | 171 | public Builder bidderName(final String bidderName) 172 | { 173 | this.bidderName = bidderName; 174 | return this; 175 | } 176 | 177 | public Builder seatBid(final List seatBid) 178 | { 179 | this.seatBid = seatBid; 180 | return this; 181 | } 182 | 183 | public Builder bidId(final String bidId) 184 | { 185 | this.bidId = bidId; 186 | return this; 187 | } 188 | 189 | public Builder cur(final String cur) 190 | { 191 | this.cur = cur; 192 | return this; 193 | } 194 | 195 | public Builder nbr(final Integer nbr) 196 | { 197 | this.nbr = nbr; 198 | return this; 199 | } 200 | 201 | public Builder ext(final Ext ext) 202 | { 203 | this.ext = ext; 204 | return this; 205 | } 206 | 207 | public MmxBidResponse build() 208 | { 209 | return new MmxBidResponse( 210 | timestamp.withZone(DateTimeZone.UTC).toString(), 211 | bidderId, 212 | bidderName, 213 | status, 214 | totalDuration, 215 | seatBid, 216 | bidId, 217 | cur, 218 | nbr, 219 | ext 220 | ); 221 | } 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/mmx/MmxClick.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.mmx; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | import org.joda.time.DateTime; 24 | import org.joda.time.DateTimeZone; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class MmxClick 28 | { 29 | private final String timestamp; 30 | private final String requestId; 31 | private final Ext ext; 32 | 33 | public MmxClick( 34 | @JsonProperty("timestamp") String timestamp, 35 | @JsonProperty("id") String requestId, 36 | @JsonProperty("ext") Ext ext 37 | ) 38 | { 39 | this.timestamp = timestamp; 40 | this.requestId = requestId; 41 | this.ext = ext; 42 | } 43 | 44 | @JsonProperty 45 | public String getTimestamp() 46 | { 47 | return timestamp; 48 | } 49 | 50 | @JsonProperty("id") 51 | public String getRequestId() 52 | { 53 | return requestId; 54 | } 55 | 56 | @JsonProperty 57 | public Ext getExt() 58 | { 59 | return ext; 60 | } 61 | 62 | public static Builder builder() 63 | { 64 | return new Builder(); 65 | } 66 | 67 | public static class Builder 68 | { 69 | private DateTime timestamp; 70 | private String requestId; 71 | private Ext ext; 72 | 73 | public Builder() {} 74 | 75 | public Builder timestamp(final DateTime timestamp) 76 | { 77 | this.timestamp = timestamp; 78 | return this; 79 | } 80 | 81 | public Builder requestId(final String requestId) 82 | { 83 | this.requestId = requestId; 84 | return this; 85 | } 86 | 87 | public Builder ext(final Ext ext) 88 | { 89 | this.ext = ext; 90 | return this; 91 | } 92 | 93 | public MmxClick build() 94 | { 95 | return new MmxClick(timestamp.withZone(DateTimeZone.UTC).toString(), requestId, ext); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/mmx/MmxImpDelivery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.mmx; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | import org.joda.time.DateTime; 24 | import org.joda.time.DateTimeZone; 25 | 26 | import java.util.List; 27 | 28 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 29 | public class MmxImpDelivery 30 | { 31 | private final String timestamp; 32 | private final String requestId; 33 | private final Double chargePrice; 34 | private final Double pubRevenue; 35 | private final Ext ext; 36 | 37 | public MmxImpDelivery( 38 | @JsonProperty("timestamp") String timestamp, 39 | @JsonProperty("id") String requestId, 40 | @JsonProperty("charge_price") Double chargePrice, 41 | @JsonProperty("pub_revenue") Double pubRevenue, 42 | @JsonProperty("ext") Ext ext 43 | ) 44 | { 45 | this.timestamp = timestamp; 46 | this.requestId = requestId; 47 | this.chargePrice = chargePrice; 48 | this.pubRevenue = pubRevenue; 49 | this.ext = ext; 50 | } 51 | 52 | @JsonProperty 53 | public String getTimestamp() 54 | { 55 | return timestamp; 56 | } 57 | 58 | @JsonProperty("id") 59 | public String getRequestId() 60 | { 61 | return requestId; 62 | } 63 | 64 | @JsonProperty("charge_price") 65 | public Double getChargePrice() 66 | { 67 | return chargePrice; 68 | } 69 | 70 | @JsonProperty("pub_revenue") 71 | public Double getPubRevenue() 72 | { 73 | return pubRevenue; 74 | } 75 | 76 | @JsonProperty 77 | public Ext getExt() 78 | { 79 | return ext; 80 | } 81 | 82 | public static Builder builder() 83 | { 84 | return new Builder(); 85 | } 86 | 87 | public static class Builder 88 | { 89 | private DateTime timestamp; 90 | private String requestId; 91 | private Double chargePrice; 92 | private Double pubRevenue; 93 | private Ext ext; 94 | 95 | public Builder() {} 96 | 97 | public Builder timestamp(final DateTime timestamp) 98 | { 99 | this.timestamp = timestamp; 100 | return this; 101 | } 102 | 103 | public Builder requestId(final String requestId) 104 | { 105 | this.requestId = requestId; 106 | return this; 107 | } 108 | 109 | public Builder chargePrice(final Double chargePrice) 110 | { 111 | this.chargePrice = chargePrice; 112 | return this; 113 | } 114 | 115 | public Builder pubRevenue(final Double pubRevenue) 116 | { 117 | this.pubRevenue = pubRevenue; 118 | return this; 119 | } 120 | 121 | public Builder ext(final Ext ext) 122 | { 123 | this.ext = ext; 124 | return this; 125 | } 126 | 127 | public MmxImpDelivery build() 128 | { 129 | return new MmxImpDelivery( 130 | timestamp.withZone(DateTimeZone.UTC).toString(), 131 | requestId, 132 | chargePrice, 133 | pubRevenue, 134 | ext 135 | ); 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/mmx/MmxSeatBid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.mmx; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | import java.util.List; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class MmxSeatBid 28 | { 29 | private final String seat; 30 | private final List bid; 31 | private final Integer group; 32 | private final Ext ext; 33 | 34 | public MmxSeatBid( 35 | @JsonProperty("seat") String seat, 36 | @JsonProperty("bid") List bid, 37 | @JsonProperty("group") Integer group, 38 | @JsonProperty("ext") Ext ext 39 | ) 40 | { 41 | this.seat = seat; 42 | this.bid = bid; 43 | this.group = group; 44 | this.ext = ext; 45 | } 46 | 47 | @JsonProperty 48 | public String getSeat() 49 | { 50 | return seat; 51 | } 52 | 53 | @JsonProperty 54 | public List getBid() 55 | { 56 | return bid; 57 | } 58 | 59 | @JsonProperty 60 | public Integer getGroup() 61 | { 62 | return group; 63 | } 64 | 65 | @JsonProperty 66 | public Ext getExt() 67 | { 68 | return ext; 69 | } 70 | 71 | public static Builder builder() 72 | { 73 | return new Builder(); 74 | } 75 | 76 | public static class Builder 77 | { 78 | private String seat; 79 | private List bid; 80 | private Integer group; 81 | private Ext ext; 82 | 83 | public Builder() {} 84 | 85 | public Builder seat(final String seat) 86 | { 87 | this.seat = seat; 88 | return this; 89 | } 90 | 91 | public Builder bid(final List bid) 92 | { 93 | this.bid = bid; 94 | return this; 95 | } 96 | 97 | public Builder group(final Integer group) 98 | { 99 | this.group = group; 100 | return this; 101 | } 102 | 103 | public Builder ext(final Ext ext) 104 | { 105 | this.ext = ext; 106 | return this; 107 | } 108 | 109 | public MmxSeatBid build() 110 | { 111 | return new MmxSeatBid(seat, bid, group, ext); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/App.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class App 27 | { 28 | private final String id; 29 | private final String name; 30 | private final String domain; 31 | private final List cat; 32 | private final List sectionCat; 33 | private final List pageCat; 34 | private final String ver; 35 | private final String bundle; 36 | private final Integer privacyPolicy; 37 | private final Integer paid; 38 | private final Publisher publisher; 39 | private final Content content; 40 | private final String keywords; 41 | private final String storeUrl; 42 | private final Ext ext; 43 | 44 | public App( 45 | @JsonProperty("id") String id, 46 | @JsonProperty("name") String name, 47 | @JsonProperty("domain") String domain, 48 | @JsonProperty("cat") List cat, 49 | @JsonProperty("sectioncat") List sectionCat, 50 | @JsonProperty("pagecat") List pageCat, 51 | @JsonProperty("ver") String ver, 52 | @JsonProperty("bundle") String bundle, 53 | @JsonProperty("privacypolicy") Integer privacyPolicy, 54 | @JsonProperty("paid") Integer paid, 55 | @JsonProperty("publisher") Publisher publisher, 56 | @JsonProperty("content") Content content, 57 | @JsonProperty("keywords") String keywords, 58 | @JsonProperty("storeurl") String storeUrl, 59 | @JsonProperty("ext") Ext ext 60 | ) 61 | { 62 | this.id = id; 63 | this.name = name; 64 | this.domain = domain; 65 | this.cat = cat; 66 | this.sectionCat = sectionCat; 67 | this.pageCat = pageCat; 68 | this.ver = ver; 69 | this.bundle = bundle; 70 | this.privacyPolicy = privacyPolicy; 71 | this.paid = paid; 72 | this.publisher = publisher; 73 | this.content = content; 74 | this.keywords = keywords; 75 | this.storeUrl = storeUrl; 76 | this.ext = ext; 77 | } 78 | 79 | @JsonProperty 80 | public String getId() 81 | { 82 | return id; 83 | } 84 | 85 | @JsonProperty 86 | public String getName() 87 | { 88 | return name; 89 | } 90 | 91 | @JsonProperty 92 | public String getDomain() 93 | { 94 | return domain; 95 | } 96 | 97 | @JsonProperty 98 | public List getCat() 99 | { 100 | return cat; 101 | } 102 | 103 | @JsonProperty("sectioncat") 104 | public List getSectionCat() 105 | { 106 | return sectionCat; 107 | } 108 | 109 | @JsonProperty("pagecat") 110 | public List getPageCat() 111 | { 112 | return pageCat; 113 | } 114 | 115 | @JsonProperty 116 | public String getVer() 117 | { 118 | return ver; 119 | } 120 | 121 | @JsonProperty 122 | public String getBundle() 123 | { 124 | return bundle; 125 | } 126 | 127 | @JsonProperty("privacypolicy") 128 | public Integer getPrivacyPolicy() 129 | { 130 | return privacyPolicy; 131 | } 132 | 133 | @JsonProperty 134 | public Integer getPaid() 135 | { 136 | return paid; 137 | } 138 | 139 | @JsonProperty 140 | public Publisher getPublisher() 141 | { 142 | return publisher; 143 | } 144 | 145 | @JsonProperty 146 | public Content getContent() 147 | { 148 | return content; 149 | } 150 | 151 | @JsonProperty 152 | public String getKeywords() 153 | { 154 | return keywords; 155 | } 156 | 157 | @JsonProperty("storeurl") 158 | public String getStoreUrl() 159 | { 160 | return storeUrl; 161 | } 162 | 163 | @JsonProperty 164 | public Ext getExt() 165 | { 166 | return ext; 167 | } 168 | 169 | public static Builder builder() 170 | { 171 | return new Builder(); 172 | } 173 | 174 | public static class Builder 175 | { 176 | private String id; 177 | private String name; 178 | private String domain; 179 | private List cat; 180 | private List sectionCat; 181 | private List pageCat; 182 | private String ver; 183 | private String bundle; 184 | private Integer privacyPolicy; 185 | private Integer paid; 186 | private Publisher publisher; 187 | private Content content; 188 | private String keywords; 189 | private String storeUrl; 190 | private Ext ext; 191 | 192 | public Builder() {} 193 | 194 | public Builder id(final String id) 195 | { 196 | this.id = id; 197 | return this; 198 | } 199 | 200 | public Builder name(final String name) 201 | { 202 | this.name = name; 203 | return this; 204 | } 205 | 206 | public Builder domain(final String domain) 207 | { 208 | this.domain = domain; 209 | return this; 210 | } 211 | 212 | public Builder cat(final List cat) 213 | { 214 | this.cat = cat; 215 | return this; 216 | } 217 | 218 | public Builder sectionCat(final List sectionCat) 219 | { 220 | this.sectionCat = sectionCat; 221 | return this; 222 | } 223 | 224 | public Builder pageCat(final List pageCat) 225 | { 226 | this.pageCat = pageCat; 227 | return this; 228 | } 229 | 230 | public Builder ver(final String ver) 231 | { 232 | this.ver = ver; 233 | return this; 234 | } 235 | 236 | public Builder bundle(final String bundle) 237 | { 238 | this.bundle = bundle; 239 | return this; 240 | } 241 | 242 | public Builder privacyPolicy(final Integer privacyPolicy) 243 | { 244 | this.privacyPolicy = privacyPolicy; 245 | return this; 246 | } 247 | 248 | public Builder paid(final Integer paid) 249 | { 250 | this.paid = paid; 251 | return this; 252 | } 253 | 254 | public Builder publisher(final Publisher publisher) 255 | { 256 | this.publisher = publisher; 257 | return this; 258 | } 259 | 260 | public Builder content(final Content content) 261 | { 262 | this.content = content; 263 | return this; 264 | } 265 | 266 | public Builder keywords(final String keywords) 267 | { 268 | this.keywords = keywords; 269 | return this; 270 | } 271 | 272 | public Builder storeUrl(final String storeUrl) 273 | { 274 | this.storeUrl = storeUrl; 275 | return this; 276 | } 277 | 278 | public Builder ext(final Ext ext) 279 | { 280 | this.ext = ext; 281 | return this; 282 | } 283 | 284 | public App build() 285 | { 286 | return new App( 287 | id, 288 | name, 289 | domain, 290 | cat, 291 | sectionCat, 292 | pageCat, 293 | ver, 294 | bundle, 295 | privacyPolicy, 296 | paid, 297 | publisher, 298 | content, 299 | keywords, 300 | storeUrl, 301 | ext 302 | ); 303 | } 304 | } 305 | } 306 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Banner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import java.util.List; 23 | 24 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 25 | public class Banner 26 | { 27 | private final Integer width; 28 | private final Integer height; 29 | private final Integer wmax; 30 | private final Integer hmax; 31 | private final Integer wmin; 32 | private final Integer hmin; 33 | private final String id; 34 | private final Integer pos; 35 | private final List btype; 36 | private final List battr; 37 | private final List mimes; 38 | private final Integer topframe; 39 | private final List expdir; 40 | private final List api; 41 | private final Ext ext; 42 | 43 | public Banner( 44 | @JsonProperty("w") Integer width, 45 | @JsonProperty("h") Integer height, 46 | @JsonProperty("wmax") Integer wmax, 47 | @JsonProperty("hmax") Integer hmax, 48 | @JsonProperty("wmin") Integer wmin, 49 | @JsonProperty("hmin") Integer hmin, 50 | @JsonProperty("id") String id, 51 | @JsonProperty("pos") Integer pos, 52 | @JsonProperty("btype") List btype, 53 | @JsonProperty("battr") List battr, 54 | @JsonProperty("mimes") List mimes, 55 | @JsonProperty("topframe") Integer topframe, 56 | @JsonProperty("expdir") List expdir, 57 | @JsonProperty("api") List api, 58 | @JsonProperty("ext") Ext ext 59 | ) 60 | { 61 | this.width = width; 62 | this.height = height; 63 | this.wmax = wmax; 64 | this.hmax = hmax; 65 | this.wmin = wmin; 66 | this.hmin = hmin; 67 | this.id = id; 68 | this.pos = pos; 69 | this.btype = btype; 70 | this.battr = battr; 71 | this.mimes = mimes; 72 | this.topframe = topframe; 73 | this.expdir = expdir; 74 | this.api = api; 75 | this.ext = ext; 76 | } 77 | 78 | @JsonProperty("w") 79 | public Integer getWidth() 80 | { 81 | return width; 82 | } 83 | 84 | @JsonProperty("h") 85 | public Integer getHeight() 86 | { 87 | return height; 88 | } 89 | 90 | @JsonProperty 91 | public Integer getWmax() 92 | { 93 | return wmax; 94 | } 95 | 96 | @JsonProperty 97 | public Integer getHmax() 98 | { 99 | return hmax; 100 | } 101 | 102 | @JsonProperty 103 | public Integer getWmin() 104 | { 105 | return wmin; 106 | } 107 | 108 | @JsonProperty 109 | public Integer getHmin() 110 | { 111 | return hmin; 112 | } 113 | 114 | @JsonProperty 115 | public String getId() 116 | { 117 | return id; 118 | } 119 | 120 | @JsonProperty 121 | public Integer getPos() 122 | { 123 | return pos; 124 | } 125 | 126 | @JsonProperty 127 | public List getBtype() 128 | { 129 | return btype; 130 | } 131 | 132 | @JsonProperty 133 | public List getBattr() 134 | { 135 | return battr; 136 | } 137 | 138 | @JsonProperty 139 | public List getMimes() 140 | { 141 | return mimes; 142 | } 143 | 144 | @JsonProperty 145 | public Integer getTopframe() 146 | { 147 | return topframe; 148 | } 149 | 150 | @JsonProperty 151 | public List getExpdir() 152 | { 153 | return expdir; 154 | } 155 | 156 | @JsonProperty 157 | public List getApi() 158 | { 159 | return api; 160 | } 161 | 162 | @JsonProperty 163 | public Ext getExt() 164 | { 165 | return ext; 166 | } 167 | 168 | public static Builder builder() 169 | { 170 | return new Builder(); 171 | } 172 | 173 | public static class Builder 174 | { 175 | private Integer width; 176 | private Integer height; 177 | private Integer wmax; 178 | private Integer hmax; 179 | private Integer wmin; 180 | private Integer hmin; 181 | private String id; 182 | private Integer pos; 183 | private List btype; 184 | private List battr; 185 | private List mimes; 186 | private Integer topframe; 187 | private List expdir; 188 | private List api; 189 | private Ext ext; 190 | 191 | public Builder() {} 192 | 193 | public Builder width(final Integer width) 194 | { 195 | this.width = width; 196 | return this; 197 | } 198 | 199 | public Builder height(final Integer height) 200 | { 201 | this.height = height; 202 | return this; 203 | } 204 | 205 | public Builder wmax(final Integer wmax) 206 | { 207 | this.wmax = wmax; 208 | return this; 209 | } 210 | 211 | public Builder hmax(final Integer hmax) 212 | { 213 | this.hmax = hmax; 214 | return this; 215 | } 216 | 217 | public Builder wmin(final Integer wmin) 218 | { 219 | this.wmin = wmin; 220 | return this; 221 | } 222 | 223 | public Builder hmin(final Integer hmin) 224 | { 225 | this.hmin = hmin; 226 | return this; 227 | } 228 | 229 | public Builder id(final String id) 230 | { 231 | this.id = id; 232 | return this; 233 | } 234 | 235 | public Builder pos(final Integer pos) 236 | { 237 | this.pos = pos; 238 | return this; 239 | } 240 | 241 | public Builder btype(final List btype) 242 | { 243 | this.btype = btype; 244 | return this; 245 | } 246 | 247 | public Builder battr(final List battr) 248 | { 249 | this.battr = battr; 250 | return this; 251 | } 252 | 253 | public Builder mimes(final List mimes) 254 | { 255 | this.mimes = mimes; 256 | return this; 257 | } 258 | 259 | public Builder topframe(final Integer topframe) 260 | { 261 | this.topframe = topframe; 262 | return this; 263 | } 264 | 265 | public Builder expdir(final List expdir) 266 | { 267 | this.expdir = expdir; 268 | return this; 269 | } 270 | 271 | public Builder api(final List api) 272 | { 273 | this.api = api; 274 | return this; 275 | } 276 | 277 | public Builder ext(final Ext ext) 278 | { 279 | this.ext = ext; 280 | return this; 281 | } 282 | 283 | public Banner build() 284 | { 285 | return new Banner( 286 | width, 287 | height, 288 | wmax, 289 | hmax, 290 | wmin, 291 | hmin, 292 | id, 293 | pos, 294 | btype, 295 | battr, 296 | mimes, 297 | topframe, 298 | expdir, 299 | api, 300 | ext 301 | ); 302 | } 303 | } 304 | 305 | } 306 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Bid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class Bid 27 | { 28 | private final String id; 29 | private final String impId; 30 | private final Double price; 31 | private final String adId; 32 | private final String nurl; 33 | private final String adm; 34 | private final List adomain; 35 | private final String bundle; 36 | private final String iUrl; 37 | private final String cId; 38 | private final String crId; 39 | private final String cat; 40 | private final List attr; 41 | private final String dealId; 42 | private final Integer height; 43 | private final Integer width; 44 | private final Ext ext; 45 | 46 | public Bid( 47 | @JsonProperty("id") String id, 48 | @JsonProperty("impid") String impId, 49 | @JsonProperty("price") Double price, 50 | @JsonProperty("adid") String adId, 51 | @JsonProperty("nurl") String nurl, 52 | @JsonProperty("adm") String adm, 53 | @JsonProperty("adomain") List adomain, 54 | @JsonProperty("bundle") String bundle, 55 | @JsonProperty("iurl") String iUrl, 56 | @JsonProperty("cid") String cId, 57 | @JsonProperty("crid") String crId, 58 | @JsonProperty("cat") String cat, 59 | @JsonProperty("attr") List attr, 60 | @JsonProperty("dealid") String dealId, 61 | @JsonProperty("h") Integer height, 62 | @JsonProperty("w") Integer width, 63 | @JsonProperty("ext") Ext ext 64 | ) 65 | { 66 | this.id = id; 67 | this.impId = impId; 68 | this.price = price; 69 | this.adId = adId; 70 | this.nurl = nurl; 71 | this.adm = adm; 72 | this.adomain = adomain; 73 | this.bundle = bundle; 74 | this.iUrl = iUrl; 75 | this.cId = cId; 76 | this.crId = crId; 77 | this.cat = cat; 78 | this.attr = attr; 79 | this.dealId = dealId; 80 | this.height = height; 81 | this.width = width; 82 | this.ext = ext; 83 | } 84 | 85 | @JsonProperty 86 | public String getId() 87 | { 88 | return id; 89 | } 90 | 91 | @JsonProperty("impid") 92 | public String getImpId() 93 | { 94 | return impId; 95 | } 96 | 97 | @JsonProperty 98 | public Double getPrice() 99 | { 100 | return price; 101 | } 102 | 103 | @JsonProperty("adid") 104 | public String getAdId() 105 | { 106 | return adId; 107 | } 108 | 109 | @JsonProperty 110 | public String getNurl() 111 | { 112 | return nurl; 113 | } 114 | 115 | @JsonProperty 116 | public String getAdm() 117 | { 118 | return adm; 119 | } 120 | 121 | @JsonProperty 122 | public List getAdomain() 123 | { 124 | return adomain; 125 | } 126 | 127 | @JsonProperty 128 | public String getBundle() 129 | { 130 | return bundle; 131 | } 132 | 133 | @JsonProperty("iurl") 134 | public String getiUrl() 135 | { 136 | return iUrl; 137 | } 138 | 139 | @JsonProperty("cid") 140 | public String getcId() 141 | { 142 | return cId; 143 | } 144 | 145 | @JsonProperty("crid") 146 | public String getCrId() 147 | { 148 | return crId; 149 | } 150 | 151 | @JsonProperty 152 | public String getCat() 153 | { 154 | return cat; 155 | } 156 | 157 | @JsonProperty 158 | public List getAttr() 159 | { 160 | return attr; 161 | } 162 | 163 | @JsonProperty("dealid") 164 | public String getDealId() 165 | { 166 | return dealId; 167 | } 168 | 169 | @JsonProperty("h") 170 | public Integer getHeight() 171 | { 172 | return height; 173 | } 174 | 175 | @JsonProperty("w") 176 | public Integer getWidth() 177 | { 178 | return width; 179 | } 180 | 181 | @JsonProperty 182 | public Ext getExt() 183 | { 184 | return ext; 185 | } 186 | 187 | public static Builder builder() 188 | { 189 | return new Builder(); 190 | } 191 | 192 | public static class Builder 193 | { 194 | private String id; 195 | private String impId; 196 | private Double price; 197 | private String adId; 198 | private String nurl; 199 | private String adm; 200 | private List adomain; 201 | private String bundle; 202 | private String iUrl; 203 | private String cId; 204 | private String crId; 205 | private String cat; 206 | private List attr; 207 | private String dealId; 208 | private Integer height; 209 | private Integer width; 210 | private Ext ext; 211 | 212 | public Builder() {} 213 | 214 | public Builder id(final String id) 215 | { 216 | this.id = id; 217 | return this; 218 | } 219 | 220 | public Builder impId(final String impId) 221 | { 222 | this.impId = impId; 223 | return this; 224 | } 225 | 226 | public Builder price(final Double price) 227 | { 228 | this.price = price; 229 | return this; 230 | } 231 | 232 | public Builder adId(final String adId) 233 | { 234 | this.adId = adId; 235 | return this; 236 | } 237 | 238 | public Builder nurl(final String nurl) 239 | { 240 | this.nurl = nurl; 241 | return this; 242 | } 243 | 244 | public Builder adm(final String adm) 245 | { 246 | this.adm = adm; 247 | return this; 248 | } 249 | 250 | public Builder adomain(final List adomain) 251 | { 252 | this.adomain = adomain; 253 | return this; 254 | } 255 | 256 | public Builder bundle(final String bundle) 257 | { 258 | this.bundle = bundle; 259 | return this; 260 | } 261 | 262 | public Builder iUrl(final String iUrl) 263 | { 264 | this.iUrl = iUrl; 265 | return this; 266 | } 267 | 268 | public Builder cId(final String cId) 269 | { 270 | this.cId = cId; 271 | return this; 272 | } 273 | 274 | public Builder crId(final String crId) 275 | { 276 | this.crId = crId; 277 | return this; 278 | } 279 | 280 | public Builder cat(final String cat) 281 | { 282 | this.cat = cat; 283 | return this; 284 | } 285 | 286 | public Builder attr(final List attr) 287 | { 288 | this.attr = attr; 289 | return this; 290 | } 291 | 292 | public Builder dealId(final String dealId) 293 | { 294 | this.dealId = dealId; 295 | return this; 296 | } 297 | 298 | public Builder height(final Integer height) 299 | { 300 | this.height = height; 301 | return this; 302 | } 303 | 304 | public Builder width(final Integer width) 305 | { 306 | this.width = width; 307 | return this; 308 | } 309 | 310 | public Builder ext(final Ext ext) 311 | { 312 | this.ext = ext; 313 | return this; 314 | } 315 | 316 | 317 | public Bid build() 318 | { 319 | return new Bid( 320 | id, 321 | impId, 322 | price, 323 | adId, 324 | nurl, 325 | adm, 326 | adomain, 327 | bundle, 328 | iUrl, 329 | cId, 330 | crId, 331 | cat, 332 | attr, 333 | dealId, 334 | height, 335 | width, 336 | ext 337 | ); 338 | } 339 | } 340 | } 341 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/BidRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.mmx.MmxBidResponse; 23 | import org.joda.time.DateTime; 24 | import org.joda.time.DateTimeZone; 25 | 26 | import java.util.List; 27 | 28 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 29 | public class BidRequest 30 | { 31 | private final String requestId; 32 | private final List impressions; 33 | private final Site site; 34 | private final App app; 35 | private final Device device; 36 | private final User user; 37 | private final Integer test; 38 | private final Integer auctionType; 39 | private final Integer tmax; 40 | private final List wseat; 41 | private final Integer allimps; 42 | private final List cur; 43 | private final List bcat; 44 | private final List badv; 45 | private final Regs regs; 46 | private final Ext ext; 47 | 48 | public BidRequest( 49 | @JsonProperty("id") String requestId, 50 | @JsonProperty("imp") List impressions, 51 | @JsonProperty("site") Site site, 52 | @JsonProperty("app") App app, 53 | @JsonProperty("device") Device device, 54 | @JsonProperty("user") User user, 55 | @JsonProperty("test") Integer test, 56 | @JsonProperty("at") Integer auctionType, 57 | @JsonProperty("tmax") Integer tmax, 58 | @JsonProperty("wseat") List wseat, 59 | @JsonProperty("allimps") Integer allimps, 60 | @JsonProperty("cur") List cur, 61 | @JsonProperty("bcat") List bcat, 62 | @JsonProperty("badv") List badv, 63 | @JsonProperty("regs") Regs regs, 64 | @JsonProperty("ext") Ext ext 65 | ) 66 | { 67 | this.requestId = requestId; 68 | this.impressions = impressions; 69 | this.site = site; 70 | this.app = app; 71 | this.device = device; 72 | this.user = user; 73 | this.test = test; 74 | this.auctionType = auctionType; 75 | this.tmax = tmax; 76 | this.wseat = wseat; 77 | this.allimps = allimps; 78 | this.cur = cur; 79 | this.bcat = bcat; 80 | this.badv = badv; 81 | this.regs = regs; 82 | this.ext = ext; 83 | } 84 | 85 | @JsonProperty("id") 86 | public String getRequestId() 87 | { 88 | return requestId; 89 | } 90 | 91 | @JsonProperty("imp") 92 | public List getImpressions() 93 | { 94 | return impressions; 95 | } 96 | 97 | @JsonProperty 98 | public Site getSite() 99 | { 100 | return site; 101 | } 102 | 103 | @JsonProperty 104 | public App getApp() 105 | { 106 | return app; 107 | } 108 | 109 | @JsonProperty 110 | public Device getDevice() 111 | { 112 | return device; 113 | } 114 | 115 | @JsonProperty 116 | public Integer getTest() 117 | { 118 | return test; 119 | } 120 | 121 | @JsonProperty 122 | public User getUser() 123 | { 124 | return user; 125 | } 126 | 127 | @JsonProperty("at") 128 | public Integer getAuctionType() 129 | { 130 | return auctionType; 131 | } 132 | 133 | @JsonProperty 134 | public Integer getTmax() 135 | { 136 | return tmax; 137 | } 138 | 139 | @JsonProperty 140 | public List getWseat() 141 | { 142 | return wseat; 143 | } 144 | 145 | @JsonProperty 146 | public Integer getAllimps() 147 | { 148 | return allimps; 149 | } 150 | 151 | @JsonProperty 152 | public List getCur() 153 | { 154 | return cur; 155 | } 156 | 157 | @JsonProperty 158 | public List getBadv() 159 | { 160 | return badv; 161 | } 162 | 163 | @JsonProperty 164 | public List getBcat() 165 | { 166 | return bcat; 167 | } 168 | 169 | @JsonProperty 170 | public Regs getRegs() 171 | { 172 | return regs; 173 | } 174 | 175 | @JsonProperty 176 | public Ext getExt() 177 | { 178 | return ext; 179 | } 180 | 181 | public static Builder builder() 182 | { 183 | return new Builder(); 184 | } 185 | 186 | public static class Builder 187 | { 188 | private String requestId; 189 | private List impressions; 190 | private Site site; 191 | private App app; 192 | private Device device; 193 | private User user; 194 | private Integer test; 195 | private Integer auctionType; 196 | private Integer tmax; 197 | private List wseat; 198 | private Integer allimps; 199 | private List cur; 200 | private List bcat; 201 | private List badv; 202 | private Regs regs; 203 | private Ext ext; 204 | 205 | public Builder() {} 206 | 207 | public Builder requestId(final String requestId) 208 | { 209 | this.requestId = requestId; 210 | return this; 211 | } 212 | 213 | public Builder impressions(final List impressions) 214 | { 215 | this.impressions = impressions; 216 | return this; 217 | } 218 | 219 | public Builder app(final App app) 220 | { 221 | this.app = app; 222 | return this; 223 | } 224 | 225 | public Builder site(final Site site) 226 | { 227 | this.site = site; 228 | return this; 229 | } 230 | 231 | public Builder device(final Device device) 232 | { 233 | this.device = device; 234 | return this; 235 | } 236 | 237 | public Builder user(final User user) 238 | { 239 | this.user = user; 240 | return this; 241 | } 242 | 243 | public Builder test(final Integer test) 244 | { 245 | this.test = test; 246 | return this; 247 | } 248 | 249 | public Builder auctionType(final Integer auctionType) 250 | { 251 | this.auctionType = auctionType; 252 | return this; 253 | } 254 | 255 | public Builder tmax(final Integer tmax) 256 | { 257 | this.tmax = tmax; 258 | return this; 259 | } 260 | 261 | public Builder wseat(final List wseat) 262 | { 263 | this.wseat = wseat; 264 | return this; 265 | } 266 | 267 | public Builder allimps(final Integer allimps) 268 | { 269 | this.allimps = allimps; 270 | return this; 271 | } 272 | 273 | public Builder cur(final List cur) 274 | { 275 | this.cur = cur; 276 | return this; 277 | } 278 | 279 | public Builder bcat(final List bcat) 280 | { 281 | this.bcat = bcat; 282 | return this; 283 | } 284 | 285 | public Builder badv(final List badv) 286 | { 287 | this.badv = badv; 288 | return this; 289 | } 290 | 291 | public Builder regs(final Regs regs) 292 | { 293 | this.regs = regs; 294 | return this; 295 | } 296 | 297 | public Builder ext(final Ext ext) 298 | { 299 | this.ext = ext; 300 | return this; 301 | } 302 | 303 | public BidRequest build() 304 | { 305 | return new BidRequest( 306 | requestId, 307 | impressions, 308 | site, 309 | app, 310 | device, 311 | user, 312 | test, 313 | auctionType, 314 | tmax, 315 | wseat, 316 | allimps, 317 | cur, 318 | bcat, 319 | badv, 320 | regs, 321 | ext 322 | ); 323 | } 324 | } 325 | } 326 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/BidResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class BidResponse 27 | { 28 | private final String id; 29 | private final List seatBid; 30 | private final String bidId; 31 | private final String cur; 32 | private final String customData; 33 | private final Integer nbr; 34 | private final Ext ext; 35 | 36 | public BidResponse( 37 | @JsonProperty("id") String id, 38 | @JsonProperty("seatbid") List seatBid, 39 | @JsonProperty("bidid") String bidId, 40 | @JsonProperty("cur") String cur, 41 | @JsonProperty("customdata") String customData, 42 | @JsonProperty("nbr") Integer nbr, 43 | @JsonProperty("ext") Ext ext 44 | ) 45 | { 46 | this.id = id; 47 | this.seatBid = seatBid; 48 | this.bidId = bidId; 49 | this.cur = cur; 50 | this.customData = customData; 51 | this.nbr = nbr; 52 | this.ext = ext; 53 | } 54 | 55 | @JsonProperty 56 | public String getId() 57 | { 58 | return id; 59 | } 60 | 61 | @JsonProperty("seatbid") 62 | public List getSeatBid() 63 | { 64 | return seatBid; 65 | } 66 | 67 | @JsonProperty("bidid") 68 | public String getBidId() 69 | { 70 | return bidId; 71 | } 72 | 73 | @JsonProperty 74 | public String getCur() 75 | { 76 | return cur; 77 | } 78 | 79 | @JsonProperty("customdata") 80 | public String getCustomData() 81 | { 82 | return customData; 83 | } 84 | 85 | @JsonProperty 86 | public Integer getNbr() 87 | { 88 | return nbr; 89 | } 90 | 91 | @JsonProperty 92 | public Ext getExt() 93 | { 94 | return ext; 95 | } 96 | 97 | public static Builder builder() 98 | { 99 | return new Builder(); 100 | } 101 | 102 | public static class Builder 103 | { 104 | private String id; 105 | private List seatBid; 106 | private String bidId; 107 | private String cur; 108 | private String customData; 109 | private Integer nbr; 110 | private Ext ext; 111 | 112 | public Builder() {} 113 | 114 | public Builder id(final String id) 115 | { 116 | this.id = id; 117 | return this; 118 | } 119 | 120 | public Builder seatBid(final List seatBid) 121 | { 122 | this.seatBid = seatBid; 123 | return this; 124 | } 125 | 126 | public Builder bidId(final String bidId) 127 | { 128 | this.bidId = bidId; 129 | return this; 130 | } 131 | 132 | public Builder cur(final String cur) 133 | { 134 | this.cur = cur; 135 | return this; 136 | } 137 | 138 | public Builder customData(final String customData) 139 | { 140 | this.customData = customData; 141 | return this; 142 | } 143 | 144 | public Builder nbr(final Integer nbr) 145 | { 146 | this.nbr = nbr; 147 | return this; 148 | } 149 | 150 | public Builder ext(final Ext ext) 151 | { 152 | this.ext = ext; 153 | return this; 154 | } 155 | 156 | public BidResponse build() 157 | { 158 | return new BidResponse( 159 | id, 160 | seatBid, 161 | bidId, 162 | cur, 163 | customData, 164 | nbr, 165 | ext 166 | ); 167 | } 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Data.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class Data 27 | { 28 | private final String id; 29 | private final String name; 30 | private final List segment; 31 | private final Ext ext; 32 | 33 | public Data( 34 | @JsonProperty("id") String id, 35 | @JsonProperty("name") String name, 36 | @JsonProperty("segment") List segment, 37 | @JsonProperty("ext") Ext ext 38 | ) 39 | { 40 | this.id = id; 41 | this.name = name; 42 | this.segment = segment; 43 | this.ext = ext; 44 | } 45 | 46 | @JsonProperty 47 | public String getId() 48 | { 49 | return id; 50 | } 51 | 52 | @JsonProperty 53 | public String getName() 54 | { 55 | return name; 56 | } 57 | 58 | @JsonProperty 59 | public List getSegment() 60 | { 61 | return segment; 62 | } 63 | 64 | @JsonProperty 65 | public Ext getExt() 66 | { 67 | return ext; 68 | } 69 | 70 | public static Builder builder() 71 | { 72 | return new Builder(); 73 | } 74 | 75 | public static class Builder 76 | { 77 | private String id; 78 | private String name; 79 | private List segment; 80 | private Ext ext; 81 | 82 | public Builder() {} 83 | 84 | public Builder id(final String id) 85 | { 86 | this.id = id; 87 | return this; 88 | } 89 | 90 | public Builder name(final String name) 91 | { 92 | this.name = name; 93 | return this; 94 | } 95 | 96 | public Builder segment(final List segment) 97 | { 98 | this.segment = segment; 99 | return this; 100 | } 101 | 102 | public Builder ext(final Ext ext) 103 | { 104 | this.ext = ext; 105 | return this; 106 | } 107 | 108 | public Data build() 109 | { 110 | return new Data(id, name, segment, ext); 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Deals.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class Deals 27 | { 28 | private final String id; 29 | private final Double bidFloor; 30 | private final String bidFloorCur; 31 | private final List wseat; 32 | private final List wadomain; 33 | private final Integer auctionType; 34 | private final Ext ext; 35 | 36 | public Deals( 37 | @JsonProperty("id") String id, 38 | @JsonProperty("bidfloor") Double bidFloor, 39 | @JsonProperty("bidfloorcur") String bidFloorCur, 40 | @JsonProperty("wseat") List wseat, 41 | @JsonProperty("wadomain") List wadomain, 42 | @JsonProperty("at") Integer auctionType, 43 | @JsonProperty("ext") Ext ext 44 | ) 45 | { 46 | this.id = id; 47 | this.bidFloor = bidFloor; 48 | this.bidFloorCur = bidFloorCur; 49 | this.wseat = wseat; 50 | this.wadomain = wadomain; 51 | this.auctionType = auctionType; 52 | this.ext = ext; 53 | } 54 | 55 | @JsonProperty 56 | public String getId() 57 | { 58 | return id; 59 | } 60 | 61 | @JsonProperty("bidfloor") 62 | public Double getBidFloor() 63 | { 64 | return bidFloor; 65 | } 66 | 67 | @JsonProperty("bidfloorcur") 68 | public String getBidFloorCur() 69 | { 70 | return bidFloorCur; 71 | } 72 | 73 | @JsonProperty 74 | public List getWseat() 75 | { 76 | return wseat; 77 | } 78 | 79 | @JsonProperty 80 | public List getWadomain() 81 | { 82 | return wadomain; 83 | } 84 | 85 | @JsonProperty("at") 86 | public Integer getAuctionType() 87 | { 88 | return auctionType; 89 | } 90 | 91 | @JsonProperty 92 | public Ext getExt() 93 | { 94 | return ext; 95 | } 96 | 97 | public static Builder builder() 98 | { 99 | return new Builder(); 100 | } 101 | 102 | public static class Builder 103 | { 104 | private String id; 105 | private Double bidFloor; 106 | private String bidFloorCur; 107 | private List wseat; 108 | private List wadomain; 109 | private Integer auctionType; 110 | private Ext ext; 111 | 112 | public Builder() {} 113 | 114 | public Builder id(final String id) 115 | { 116 | this.id = id; 117 | return this; 118 | } 119 | 120 | public Builder bidFloor(final Double bidFloor) 121 | { 122 | this.bidFloor = bidFloor; 123 | return this; 124 | } 125 | 126 | public Builder bidFloorCur(final String bidFloorCur) 127 | { 128 | this.bidFloorCur = bidFloorCur; 129 | return this; 130 | } 131 | 132 | public Builder wseat(final List wseat) 133 | { 134 | this.wseat = wseat; 135 | return this; 136 | } 137 | 138 | public Builder wadomain(final List wadomain) 139 | { 140 | this.wadomain = wadomain; 141 | return this; 142 | } 143 | 144 | public Builder auctionType(final Integer auctionType) 145 | { 146 | this.auctionType = auctionType; 147 | return this; 148 | } 149 | 150 | public Builder ext(final Ext ext) 151 | { 152 | this.ext = ext; 153 | return this; 154 | } 155 | 156 | public Deals build() 157 | { 158 | return new Deals(id, bidFloor, bidFloorCur, wseat, wadomain, auctionType, ext); 159 | } 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Ext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonCreator; 21 | import com.fasterxml.jackson.annotation.JsonInclude; 22 | import com.fasterxml.jackson.annotation.JsonValue; 23 | 24 | import java.util.HashMap; 25 | import java.util.List; 26 | import java.util.Map; 27 | 28 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 29 | public class Ext 30 | { 31 | private final Map values; 32 | 33 | private Ext( 34 | Map values 35 | ) 36 | { 37 | this.values = values; 38 | } 39 | 40 | @JsonCreator 41 | private static Ext fromMap(Map map) { 42 | return new Ext(map); 43 | } 44 | 45 | @JsonValue 46 | public Map getValues() { 47 | return values; 48 | } 49 | 50 | public static Builder builder() 51 | { 52 | return new Builder(); 53 | } 54 | 55 | public static class Builder 56 | { 57 | private Map values = new HashMap(); 58 | 59 | public Builder() {} 60 | 61 | public Builder put(String k, String v) 62 | { 63 | this.values.put(k, v); 64 | return this; 65 | } 66 | 67 | public Builder put(String k, int v) 68 | { 69 | this.values.put(k, v); 70 | return this; 71 | } 72 | 73 | public Builder put(String k, double v) 74 | { 75 | this.values.put(k, v); 76 | return this; 77 | } 78 | 79 | public Builder put(String k, List v) 80 | { 81 | this.values.put(k, v); 82 | return this; 83 | } 84 | 85 | public Ext build() 86 | { 87 | return new Ext(values); 88 | } 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Geo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 24 | public class Geo 25 | { 26 | private final Double lat; 27 | private final Double lon; 28 | private final String country; 29 | private final String region; 30 | private final String regionfips104; 31 | private final String metro; 32 | private final String city; 33 | private final String zip; 34 | private final Integer type; 35 | private final Integer utcoffset; 36 | private final Ext ext; 37 | 38 | public Geo( 39 | @JsonProperty("lat") Double lat, 40 | @JsonProperty("lon") Double lon, 41 | @JsonProperty("country") String country, 42 | @JsonProperty("region") String region, 43 | @JsonProperty("regionfips104") String regionfips104, 44 | @JsonProperty("metro") String metro, 45 | @JsonProperty("city") String city, 46 | @JsonProperty("zip") String zip, 47 | @JsonProperty("type") Integer type, 48 | @JsonProperty("utcoffset") Integer utcoffset, 49 | @JsonProperty("ext") Ext ext 50 | ) 51 | { 52 | this.lat = lat; 53 | this.lon = lon; 54 | this.country = country; 55 | this.region = region; 56 | this.regionfips104 = regionfips104; 57 | this.metro = metro; 58 | this.city = city; 59 | this.zip = zip; 60 | this.type = type; 61 | this.utcoffset = utcoffset; 62 | this.ext = ext; 63 | } 64 | 65 | @JsonProperty 66 | public Double getLat() 67 | { 68 | return lat; 69 | } 70 | 71 | @JsonProperty 72 | public Double getLon() 73 | { 74 | return lon; 75 | } 76 | 77 | @JsonProperty 78 | public String getCountry() 79 | { 80 | return country; 81 | } 82 | 83 | @JsonProperty 84 | public String getRegion() 85 | { 86 | return region; 87 | } 88 | 89 | @JsonProperty 90 | public String getRegionfips104() 91 | { 92 | return regionfips104; 93 | } 94 | 95 | @JsonProperty 96 | public String getMetro() 97 | { 98 | return metro; 99 | } 100 | 101 | @JsonProperty 102 | public String getCity() 103 | { 104 | return city; 105 | } 106 | 107 | @JsonProperty 108 | public String getZip() 109 | { 110 | return zip; 111 | } 112 | 113 | @JsonProperty 114 | public Integer getType() 115 | { 116 | return type; 117 | } 118 | 119 | @JsonProperty 120 | public Integer getUtcoffset() 121 | { 122 | return utcoffset; 123 | } 124 | 125 | @JsonProperty 126 | public Ext getExt() 127 | { 128 | return ext; 129 | } 130 | 131 | public static Builder builder() 132 | { 133 | return new Builder(); 134 | } 135 | 136 | public static class Builder 137 | { 138 | private Double lat; 139 | private Double lon; 140 | private String country; 141 | private String region; 142 | private String regionfips104; 143 | private String metro; 144 | private String city; 145 | private String zip; 146 | private Integer type; 147 | private Integer utcoffset; 148 | private Ext ext; 149 | 150 | public Builder() {} 151 | 152 | public Builder lat(final Double lat) 153 | { 154 | this.lat = lat; 155 | return this; 156 | } 157 | 158 | public Builder lon(final Double lon) 159 | { 160 | this.lon = lon; 161 | return this; 162 | } 163 | 164 | public Builder country(final String country) 165 | { 166 | this.country = country; 167 | return this; 168 | } 169 | 170 | public Builder region(final String region) 171 | { 172 | this.region = region; 173 | return this; 174 | } 175 | 176 | public Builder regionfips104(final String regionfips104) 177 | { 178 | this.regionfips104 = regionfips104; 179 | return this; 180 | } 181 | 182 | public Builder city(final String city) 183 | { 184 | this.city = city; 185 | return this; 186 | } 187 | 188 | public Builder zip(final String zip) 189 | { 190 | this.zip = zip; 191 | return this; 192 | } 193 | 194 | public Builder metro(final String metro) 195 | { 196 | this.metro = metro; 197 | return this; 198 | } 199 | 200 | public Builder type(final Integer type) 201 | { 202 | this.type = type; 203 | return this; 204 | } 205 | 206 | public Builder utcoffset(final Integer utcoffset) 207 | { 208 | this.utcoffset = utcoffset; 209 | return this; 210 | } 211 | 212 | public Builder ext(final Ext ext) 213 | { 214 | this.ext = ext; 215 | return this; 216 | } 217 | 218 | public Geo build() 219 | { 220 | return new Geo( 221 | lat, 222 | lon, 223 | country, 224 | region, 225 | regionfips104, 226 | metro, 227 | city, 228 | zip, 229 | type, 230 | utcoffset, 231 | ext 232 | ); 233 | } 234 | } 235 | } 236 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Imp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import java.util.List; 23 | 24 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 25 | public class Imp 26 | { 27 | private final String id; 28 | private final Banner banner; 29 | private final Video video; 30 | private final Native nativeObj; 31 | private final String displayManager; 32 | private final String displayManagerVer; 33 | private final Integer instl; 34 | private final String tagId; 35 | private final Double bidFloor; 36 | private final String bidFloorCur; 37 | private final Integer secure; 38 | private final List iframeBuster; 39 | private final Pmp pmp; 40 | private final Ext ext; 41 | 42 | public Imp( 43 | @JsonProperty("id") String id, 44 | @JsonProperty("banner") Banner banner, 45 | @JsonProperty("video") Video video, 46 | @JsonProperty("native") Native nativeObj, 47 | @JsonProperty("displaymanager") String displayManager, 48 | @JsonProperty("displaymanagerver") String displayManagerVer, 49 | @JsonProperty("instl") Integer instl, 50 | @JsonProperty("tagid") String tagId, 51 | @JsonProperty("bidfloor") Double bidFloor, 52 | @JsonProperty("bidfloorcur") String bidFloorCur, 53 | @JsonProperty("secure") Integer secure, 54 | @JsonProperty("iframebuster") List iframeBuster, 55 | @JsonProperty("pmp") Pmp pmp, 56 | @JsonProperty("ext") Ext ext 57 | ) 58 | { 59 | this.id = id; 60 | this.banner = banner; 61 | this.video = video; 62 | this.nativeObj = nativeObj; 63 | this.displayManager = displayManager; 64 | this.displayManagerVer = displayManagerVer; 65 | this.instl = instl; 66 | this.tagId = tagId; 67 | this.bidFloor = bidFloor; 68 | this.bidFloorCur = bidFloorCur; 69 | this.secure = secure; 70 | this.iframeBuster = iframeBuster; 71 | this.pmp = pmp; 72 | this.ext = ext; 73 | } 74 | 75 | @JsonProperty 76 | public String getId() 77 | { 78 | return id; 79 | } 80 | 81 | @JsonProperty 82 | public Banner getBanner() 83 | { 84 | return banner; 85 | } 86 | 87 | @JsonProperty 88 | public Video getVideo() 89 | { 90 | return video; 91 | } 92 | 93 | @JsonProperty 94 | public Native getNative() 95 | { 96 | return nativeObj; 97 | } 98 | 99 | @JsonProperty("displaymanager") 100 | public String getDisplayManager() 101 | { 102 | return displayManager; 103 | } 104 | 105 | @JsonProperty("displaymanagerver") 106 | public String getDisplayManagerVer() 107 | { 108 | return displayManagerVer; 109 | } 110 | 111 | @JsonProperty 112 | public Integer getInstl() 113 | { 114 | return instl; 115 | } 116 | 117 | @JsonProperty("tagid") 118 | public String getTagId() 119 | { 120 | return tagId; 121 | } 122 | 123 | @JsonProperty("bidfloor") 124 | public Double getBidFloor() 125 | { 126 | return bidFloor; 127 | } 128 | 129 | @JsonProperty("bidfloorcur") 130 | public String getBidFloorCur() 131 | { 132 | return bidFloorCur; 133 | } 134 | 135 | @JsonProperty 136 | public Integer getSecure() 137 | { 138 | return secure; 139 | } 140 | 141 | @JsonProperty("iframebuster") 142 | public List getIframeBuster() 143 | { 144 | return iframeBuster; 145 | } 146 | 147 | @JsonProperty 148 | public Pmp getPmp() 149 | { 150 | return pmp; 151 | } 152 | 153 | @JsonProperty 154 | public Ext getExt() 155 | { 156 | return ext; 157 | } 158 | 159 | public static Builder builder() 160 | { 161 | return new Builder(); 162 | } 163 | 164 | public static class Builder 165 | { 166 | private String id; 167 | private Banner banner; 168 | private Video video; 169 | private Native nativeObj; 170 | private String displayManager; 171 | private String displayManagerVer; 172 | private Integer instl; 173 | private String tagId; 174 | private Double bidFloor; 175 | private String bidFloorCur; 176 | private Integer secure; 177 | private List iframebuster; 178 | private Pmp pmp; 179 | private Ext ext; 180 | 181 | public Builder() {} 182 | 183 | public Builder id(final String id) 184 | { 185 | this.id = id; 186 | return this; 187 | } 188 | 189 | public Builder banner(final Banner banner) 190 | { 191 | this.banner = banner; 192 | return this; 193 | } 194 | 195 | public Builder video(final Video video) 196 | { 197 | this.video = video; 198 | return this; 199 | } 200 | 201 | public Builder nativeObj(final Native nativeObj) 202 | { 203 | this.nativeObj = nativeObj; 204 | return this; 205 | } 206 | 207 | public Builder displayManager(final String displayManager) 208 | { 209 | this.displayManager = displayManager; 210 | return this; 211 | } 212 | 213 | public Builder displayManagerVer(final String displayManagerVer) 214 | { 215 | this.displayManagerVer = displayManagerVer; 216 | return this; 217 | } 218 | 219 | public Builder instl(final Integer instl) 220 | { 221 | this.instl = instl; 222 | return this; 223 | } 224 | 225 | public Builder tagId(final String tagId) 226 | { 227 | this.tagId = tagId; 228 | return this; 229 | } 230 | 231 | public Builder bidFloor(final Double bidFloor) 232 | { 233 | this.bidFloor = bidFloor; 234 | return this; 235 | } 236 | public Builder bidFloorCur(final String bidFloorCur) 237 | { 238 | this.bidFloorCur = bidFloorCur; 239 | return this; 240 | } 241 | 242 | public Builder secure(final Integer secure) 243 | { 244 | this.secure = secure; 245 | return this; 246 | } 247 | 248 | public Builder iframebuster(final List iframebuster) 249 | { 250 | this.iframebuster = iframebuster; 251 | return this; 252 | } 253 | 254 | public Builder pmp(final Pmp pmp) 255 | { 256 | this.pmp = pmp; 257 | return this; 258 | } 259 | 260 | public Builder ext(final Ext ext) 261 | { 262 | this.ext = ext; 263 | return this; 264 | } 265 | 266 | public Imp build() 267 | { 268 | return new Imp( 269 | id, 270 | banner, 271 | video, 272 | nativeObj, 273 | displayManager, 274 | displayManagerVer, 275 | instl, 276 | tagId, 277 | bidFloor, 278 | bidFloorCur, 279 | secure, 280 | iframebuster, 281 | pmp, 282 | ext 283 | ); 284 | } 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Native.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class Native 27 | { 28 | private final String request; 29 | private final String ver; 30 | private final List api; 31 | private final List battr; 32 | private final Ext ext; 33 | 34 | public Native( 35 | @JsonProperty("request") String request, 36 | @JsonProperty("ver") String ver, 37 | @JsonProperty("api") List api, 38 | @JsonProperty("battr") List battr, 39 | @JsonProperty("ext") Ext ext 40 | ) 41 | { 42 | this.request = request; 43 | this.ver = ver; 44 | this.api = api; 45 | this.battr = battr; 46 | this.ext = ext; 47 | } 48 | 49 | @JsonProperty 50 | public String getRequest() 51 | { 52 | return request; 53 | } 54 | 55 | @JsonProperty 56 | public String getVer() 57 | { 58 | return ver; 59 | } 60 | 61 | @JsonProperty 62 | public List getApi() 63 | { 64 | return api; 65 | } 66 | 67 | @JsonProperty 68 | public List getBattr() 69 | { 70 | return battr; 71 | } 72 | 73 | @JsonProperty 74 | public Ext getExt() 75 | { 76 | return ext; 77 | } 78 | 79 | public static Builder builder() 80 | { 81 | return new Builder(); 82 | } 83 | 84 | public static class Builder 85 | { 86 | private String request; 87 | private String ver = "1"; 88 | private List api; 89 | private List battr; 90 | private Ext ext; 91 | 92 | public Builder() {} 93 | 94 | public Builder request(final String request) 95 | { 96 | this.request = request; 97 | return this; 98 | } 99 | 100 | public Builder ver(final String ver) 101 | { 102 | this.ver = ver; 103 | return this; 104 | } 105 | 106 | public Builder api(final List api) 107 | { 108 | this.api = api; 109 | return this; 110 | } 111 | 112 | public Builder battr(final List battr) 113 | { 114 | this.battr = battr; 115 | return this; 116 | } 117 | 118 | public Builder ext(final Ext ext) 119 | { 120 | this.ext = ext; 121 | return this; 122 | } 123 | 124 | public Native build() 125 | { 126 | return new Native( 127 | request, 128 | ver, 129 | api, 130 | battr, 131 | ext 132 | ); 133 | } 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Pmp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class Pmp 27 | { 28 | private final Integer privateAuction; 29 | private final List deals; 30 | private final Ext ext; 31 | 32 | public Pmp( 33 | @JsonProperty("private_auction") Integer privateAuction, 34 | @JsonProperty("deals") List deals, 35 | @JsonProperty("ext") Ext ext 36 | ) 37 | { 38 | this.privateAuction = privateAuction; 39 | this.deals = deals; 40 | this.ext = ext; 41 | } 42 | 43 | @JsonProperty("private_auction") 44 | public Integer getPrivateAuction() 45 | { 46 | return privateAuction; 47 | } 48 | 49 | @JsonProperty 50 | public List getDeals() 51 | { 52 | return deals; 53 | } 54 | 55 | @JsonProperty 56 | public Ext getExt() 57 | { 58 | return ext; 59 | } 60 | 61 | public static Builder builder() 62 | { 63 | return new Builder(); 64 | } 65 | 66 | public static class Builder 67 | { 68 | private Integer privateAuction; 69 | private List deals; 70 | private Ext ext; 71 | 72 | public Builder() {} 73 | 74 | public Builder privateAuction(final Integer privateAuction) 75 | { 76 | this.privateAuction = privateAuction; 77 | return this; 78 | } 79 | 80 | public Builder deals(final List deals) 81 | { 82 | this.deals = deals; 83 | return this; 84 | } 85 | 86 | public Builder ext(final Ext ext) 87 | { 88 | this.ext = ext; 89 | return this; 90 | } 91 | 92 | public Pmp build() 93 | { 94 | return new Pmp(privateAuction, deals, ext); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Producer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class Producer 27 | { 28 | private final String id; 29 | private final String name; 30 | private final List cat; 31 | private final String domain; 32 | private final Ext ext; 33 | 34 | public Producer( 35 | @JsonProperty("id") String id, 36 | @JsonProperty("name") String name, 37 | @JsonProperty("cat") List cat, 38 | @JsonProperty("domain") String domain, 39 | @JsonProperty("ext") Ext ext 40 | ) 41 | { 42 | this.id = id; 43 | this.name = name; 44 | this.cat = cat; 45 | this.domain = domain; 46 | this.ext = ext; 47 | } 48 | 49 | @JsonProperty 50 | public String getId() 51 | { 52 | return id; 53 | } 54 | 55 | @JsonProperty 56 | public String getName() 57 | { 58 | return name; 59 | } 60 | 61 | @JsonProperty public List getCat() 62 | { 63 | return cat; 64 | } 65 | 66 | @JsonProperty 67 | public String getDomain() 68 | { 69 | return domain; 70 | } 71 | 72 | @JsonProperty 73 | public Ext getExt() 74 | { 75 | return ext; 76 | } 77 | 78 | public static Builder builder() 79 | { 80 | return new Builder(); 81 | } 82 | 83 | public static class Builder 84 | { 85 | private String id; 86 | private String name; 87 | private List cat; 88 | private String domain; 89 | private Ext ext; 90 | 91 | public Builder() {} 92 | 93 | public Builder id(final String id) 94 | { 95 | this.id = id; 96 | return this; 97 | } 98 | 99 | public Builder name(final String name) 100 | { 101 | this.name = name; 102 | return this; 103 | } 104 | 105 | public Builder cat(final List cat) 106 | { 107 | this.cat = cat; 108 | return this; 109 | } 110 | 111 | public Builder domain(final String domain) 112 | { 113 | this.domain = domain; 114 | return this; 115 | } 116 | 117 | public Builder ext(final Ext ext) 118 | { 119 | this.ext = ext; 120 | return this; 121 | } 122 | 123 | public Producer build() 124 | { 125 | return new Producer(id, name, cat, domain, ext); 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Publisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class Publisher 27 | { 28 | private final String id; 29 | private final String name; 30 | private final List cat; 31 | private final String domain; 32 | private final Ext ext; 33 | 34 | public Publisher( 35 | @JsonProperty("id") String id, 36 | @JsonProperty("name") String name, 37 | @JsonProperty("cat") List cat, 38 | @JsonProperty("domain") String domain, 39 | @JsonProperty("ext") Ext ext 40 | ) 41 | { 42 | this.id = id; 43 | this.name = name; 44 | this.cat = cat; 45 | this.domain = domain; 46 | this.ext = ext; 47 | } 48 | 49 | @JsonProperty 50 | public String getId() 51 | { 52 | return id; 53 | } 54 | 55 | @JsonProperty 56 | public String getName() 57 | { 58 | return name; 59 | } 60 | 61 | @JsonProperty public List getCat() 62 | { 63 | return cat; 64 | } 65 | 66 | @JsonProperty 67 | public String getDomain() 68 | { 69 | return domain; 70 | } 71 | 72 | @JsonProperty 73 | public Ext getExt() 74 | { 75 | return ext; 76 | } 77 | 78 | public static Builder builder() 79 | { 80 | return new Builder(); 81 | } 82 | 83 | public static class Builder 84 | { 85 | private String id; 86 | private String name; 87 | private List cat; 88 | private String domain; 89 | private Ext ext; 90 | 91 | public Builder() {} 92 | 93 | public Builder id(final String id) 94 | { 95 | this.id = id; 96 | return this; 97 | } 98 | 99 | public Builder name(final String name) 100 | { 101 | this.name = name; 102 | return this; 103 | } 104 | 105 | public Builder cat(final List cat) 106 | { 107 | this.cat = cat; 108 | return this; 109 | } 110 | 111 | public Builder domain(final String domain) 112 | { 113 | this.domain = domain; 114 | return this; 115 | } 116 | 117 | public Builder ext(final Ext ext) 118 | { 119 | this.ext = ext; 120 | return this; 121 | } 122 | 123 | public Publisher build() 124 | { 125 | return new Publisher(id, name, cat, domain, ext); 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Regs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class Regs 27 | { 28 | private final Integer coppa; 29 | private final Ext ext; 30 | 31 | public Regs( 32 | @JsonProperty("coppa") Integer coppa, 33 | @JsonProperty("ext") Ext ext 34 | ) 35 | { 36 | this.coppa = coppa; 37 | this.ext = ext; 38 | } 39 | 40 | @JsonProperty 41 | public Integer getCoppa() 42 | { 43 | return coppa; 44 | } 45 | 46 | @JsonProperty 47 | public Ext getExt() 48 | { 49 | return ext; 50 | } 51 | 52 | public static Builder builder() 53 | { 54 | return new Builder(); 55 | } 56 | 57 | public static class Builder 58 | { 59 | private Integer coppa; 60 | private Ext ext; 61 | 62 | public Builder() {} 63 | 64 | public Builder coppa(final Integer coppa) 65 | { 66 | this.coppa = coppa; 67 | return this; 68 | } 69 | 70 | public Builder ext(final Ext ext) 71 | { 72 | this.ext = ext; 73 | return this; 74 | } 75 | 76 | public Regs build() 77 | { 78 | return new Regs(coppa, ext); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/SeatBid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class SeatBid 27 | { 28 | private final String seat; 29 | private final List bid; 30 | private final Integer group; 31 | private final Ext ext; 32 | 33 | public SeatBid( 34 | @JsonProperty("seat") String seat, 35 | @JsonProperty("bid") List bid, 36 | @JsonProperty("group") Integer group, 37 | @JsonProperty("ext") Ext ext 38 | ) 39 | { 40 | this.seat = seat; 41 | this.bid = bid; 42 | this.group = group; 43 | this.ext = ext; 44 | } 45 | 46 | @JsonProperty 47 | public String getSeat() 48 | { 49 | return seat; 50 | } 51 | 52 | @JsonProperty 53 | public List getBid() 54 | { 55 | return bid; 56 | } 57 | 58 | @JsonProperty 59 | public Integer getGroup() 60 | { 61 | return group; 62 | } 63 | 64 | @JsonProperty 65 | public Ext getExt() 66 | { 67 | return ext; 68 | } 69 | 70 | public static Builder builder() 71 | { 72 | return new Builder(); 73 | } 74 | 75 | public static class Builder 76 | { 77 | private String seat; 78 | private List bid; 79 | private Integer group; 80 | private Ext ext; 81 | 82 | public Builder() {} 83 | 84 | public Builder seat(final String seat) 85 | { 86 | this.seat = seat; 87 | return this; 88 | } 89 | 90 | public Builder bid(final List bid) 91 | { 92 | this.bid = bid; 93 | return this; 94 | } 95 | 96 | public Builder group(final Integer group) 97 | { 98 | this.group = group; 99 | return this; 100 | } 101 | 102 | public Builder ext(final Ext ext) 103 | { 104 | this.ext = ext; 105 | return this; 106 | } 107 | 108 | public SeatBid build() 109 | { 110 | return new SeatBid(seat, bid, group, ext); 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Segment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 24 | public class Segment 25 | { 26 | private final String id; 27 | private final String name; 28 | private final String value; 29 | private final Ext ext; 30 | 31 | public Segment( 32 | @JsonProperty("id") String id, 33 | @JsonProperty("name") String name, 34 | @JsonProperty("value") String value, 35 | @JsonProperty("ext") Ext ext 36 | ) 37 | { 38 | this.id = id; 39 | this.name = name; 40 | this.value = value; 41 | this.ext = ext; 42 | } 43 | 44 | @JsonProperty 45 | public String getId() 46 | { 47 | return id; 48 | } 49 | 50 | @JsonProperty 51 | public String getName() 52 | { 53 | return name; 54 | } 55 | 56 | @JsonProperty 57 | public String getValue() 58 | { 59 | return value; 60 | } 61 | 62 | @JsonProperty 63 | public Ext getExt() 64 | { 65 | return ext; 66 | } 67 | 68 | public static Builder builder() 69 | { 70 | return new Builder(); 71 | } 72 | 73 | public static class Builder 74 | { 75 | private String id; 76 | private String name; 77 | private String value; 78 | private Ext ext; 79 | 80 | public Builder() {} 81 | 82 | public Builder id(final String id) 83 | { 84 | this.id = id; 85 | return this; 86 | } 87 | 88 | public Builder name(final String name) 89 | { 90 | this.name = name; 91 | return this; 92 | } 93 | 94 | public Builder value(final String value) 95 | { 96 | this.value = value; 97 | return this; 98 | } 99 | 100 | public Builder ext(final Ext ext) 101 | { 102 | this.ext = ext; 103 | return this; 104 | } 105 | 106 | public Segment build() 107 | { 108 | return new Segment(id, name, value, ext); 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/Site.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class Site 27 | { 28 | private final String id; 29 | private final String name; 30 | private final String domain; 31 | private final List cat; 32 | private final List sectionCat; 33 | private final List pageCat; 34 | private final String page; 35 | private final Integer privacyPolicy; 36 | private final String ref; 37 | private final String search; 38 | private final Integer mobile; 39 | private final Publisher publisher; 40 | private final Content content; 41 | private final String keywords; 42 | private final Ext ext; 43 | 44 | public Site( 45 | @JsonProperty("id") String id, 46 | @JsonProperty("name") String name, 47 | @JsonProperty("domain") String domain, 48 | @JsonProperty("cat") List cat, 49 | @JsonProperty("sectioncat") List sectionCat, 50 | @JsonProperty("pagecat") List pageCat, 51 | @JsonProperty("page") String page, 52 | @JsonProperty("privacypolicy") Integer privacyPolicy, 53 | @JsonProperty("ref") String ref, 54 | @JsonProperty("search") String search, 55 | @JsonProperty("mobile") Integer mobile, 56 | @JsonProperty("publisher") Publisher publisher, 57 | @JsonProperty("content") Content content, 58 | @JsonProperty("keywords") String keywords, 59 | @JsonProperty("ext") Ext ext 60 | ) 61 | { 62 | this.id = id; 63 | this.name = name; 64 | this.domain = domain; 65 | this.cat = cat; 66 | this.sectionCat = sectionCat; 67 | this.pageCat = pageCat; 68 | this.page = page; 69 | this.privacyPolicy = privacyPolicy; 70 | this.ref = ref; 71 | this.search = search; 72 | this.mobile = mobile; 73 | this.publisher = publisher; 74 | this.content = content; 75 | this.keywords = keywords; 76 | this.ext = ext; 77 | } 78 | 79 | @JsonProperty 80 | public String getId() 81 | { 82 | return id; 83 | } 84 | 85 | @JsonProperty 86 | public String getName() 87 | { 88 | return name; 89 | } 90 | 91 | @JsonProperty 92 | public String getDomain() 93 | { 94 | return domain; 95 | } 96 | 97 | @JsonProperty 98 | public List getCat() 99 | { 100 | return cat; 101 | } 102 | 103 | @JsonProperty("sectioncat") 104 | public List getSectionCat() 105 | { 106 | return sectionCat; 107 | } 108 | 109 | @JsonProperty("pagecat") 110 | public List getPageCat() 111 | { 112 | return pageCat; 113 | } 114 | 115 | @JsonProperty 116 | public String getPage() 117 | { 118 | return page; 119 | } 120 | 121 | @JsonProperty("privacypolicy") 122 | public Integer getPrivacyPolicy() 123 | { 124 | return privacyPolicy; 125 | } 126 | 127 | @JsonProperty 128 | public String getRef() 129 | { 130 | return ref; 131 | } 132 | 133 | @JsonProperty 134 | public String getSearch() 135 | { 136 | return search; 137 | } 138 | 139 | @JsonProperty 140 | public Integer getMobile() 141 | { 142 | return mobile; 143 | } 144 | 145 | @JsonProperty 146 | public Publisher getPublisher() 147 | { 148 | return publisher; 149 | } 150 | 151 | @JsonProperty 152 | public Content getContent() 153 | { 154 | return content; 155 | } 156 | 157 | @JsonProperty 158 | public String getKeywords() 159 | { 160 | return keywords; 161 | } 162 | 163 | @JsonProperty 164 | public Ext getExt() 165 | { 166 | return ext; 167 | } 168 | 169 | public static Builder builder() 170 | { 171 | return new Builder(); 172 | } 173 | 174 | public static class Builder 175 | { 176 | private String id; 177 | private String name; 178 | private String domain; 179 | private List cat; 180 | private List sectionCat; 181 | private List pageCat; 182 | private String page; 183 | private Integer privacyPolicy; 184 | private String ref; 185 | private String search; 186 | private Integer mobile; 187 | private Publisher publisher; 188 | private Content content; 189 | private String keywords; 190 | private Ext ext; 191 | 192 | public Builder() {} 193 | 194 | public Builder id(final String id) 195 | { 196 | this.id = id; 197 | return this; 198 | } 199 | 200 | public Builder name(final String name) 201 | { 202 | this.name = name; 203 | return this; 204 | } 205 | 206 | public Builder domain(final String domain) 207 | { 208 | this.domain = domain; 209 | return this; 210 | } 211 | 212 | public Builder cat(final List cat) 213 | { 214 | this.cat = cat; 215 | return this; 216 | } 217 | 218 | public Builder sectionCat(final List sectionCat) 219 | { 220 | this.sectionCat = sectionCat; 221 | return this; 222 | } 223 | 224 | public Builder pageCat(final List pageCat) 225 | { 226 | this.pageCat = pageCat; 227 | return this; 228 | } 229 | 230 | public Builder page(final String page) 231 | { 232 | this.page = page; 233 | return this; 234 | } 235 | 236 | public Builder privacyPolicy(final Integer privacyPolicy) 237 | { 238 | this.privacyPolicy = privacyPolicy; 239 | return this; 240 | } 241 | 242 | public Builder ref(final String ref) 243 | { 244 | this.ref = ref; 245 | return this; 246 | } 247 | 248 | public Builder search(final String search) 249 | { 250 | this.search = search; 251 | return this; 252 | } 253 | 254 | public Builder mobile(final Integer mobile) 255 | { 256 | this.mobile = mobile; 257 | return this; 258 | } 259 | 260 | public Builder publisher(final Publisher publisher) 261 | { 262 | this.publisher = publisher; 263 | return this; 264 | } 265 | 266 | public Builder content(final Content content) 267 | { 268 | this.content = content; 269 | return this; 270 | } 271 | 272 | public Builder keywords(final String keywords) 273 | { 274 | this.keywords = keywords; 275 | return this; 276 | } 277 | 278 | public Builder ext(final Ext ext) 279 | { 280 | this.ext = ext; 281 | return this; 282 | } 283 | 284 | public Site build() 285 | { 286 | return new Site( 287 | id, 288 | name, 289 | domain, 290 | cat, 291 | sectionCat, 292 | pageCat, 293 | page, 294 | privacyPolicy, 295 | ref, 296 | search, 297 | mobile, 298 | publisher, 299 | content, 300 | keywords, 301 | ext 302 | ); 303 | } 304 | } 305 | } 306 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtb/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | import java.util.List; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class User 27 | { 28 | private final String id; 29 | private final String buyerid; 30 | private final Integer yob; 31 | private final String gender; 32 | private final String keywords; 33 | private final String customData; 34 | private final Geo geo; 35 | private final List data; 36 | private final Ext ext; 37 | 38 | public User( 39 | @JsonProperty("id") String id, 40 | @JsonProperty("buyerid") String buyerid, 41 | @JsonProperty("yob") Integer yob, 42 | @JsonProperty("gender") String gender, 43 | @JsonProperty("keywords") String keywords, 44 | @JsonProperty("customdata") String customData, 45 | @JsonProperty("geo") Geo geo, 46 | @JsonProperty("data") List data, 47 | @JsonProperty("ext") Ext ext 48 | ) 49 | { 50 | this.id = id; 51 | this.buyerid = buyerid; 52 | this.yob = yob; 53 | this.gender = gender; 54 | this.keywords = keywords; 55 | this.customData = customData; 56 | this.geo = geo; 57 | this.data = data; 58 | this.ext = ext; 59 | } 60 | 61 | @JsonProperty 62 | public String getId() 63 | { 64 | return id; 65 | } 66 | 67 | @JsonProperty 68 | public String getBuyerid() 69 | { 70 | return buyerid; 71 | } 72 | 73 | @JsonProperty 74 | public Integer getYob() 75 | { 76 | return yob; 77 | } 78 | 79 | @JsonProperty 80 | public String getGender() 81 | { 82 | return gender; 83 | } 84 | 85 | @JsonProperty 86 | public String getKeywords() 87 | { 88 | return keywords; 89 | } 90 | 91 | @JsonProperty("customdata") 92 | public String getCustomData() 93 | { 94 | return customData; 95 | } 96 | 97 | @JsonProperty 98 | public Geo getGeo() 99 | { 100 | return geo; 101 | } 102 | 103 | @JsonProperty 104 | public List getData() 105 | { 106 | return data; 107 | } 108 | 109 | @JsonProperty 110 | public Ext getExt() 111 | { 112 | return ext; 113 | } 114 | 115 | public static Builder builder() 116 | { 117 | return new Builder(); 118 | } 119 | 120 | public static class Builder 121 | { 122 | private String id; 123 | private String buyerid; 124 | private Integer yob; 125 | private String gender; 126 | private String keywords; 127 | private String customData; 128 | private Geo geo; 129 | private List data; 130 | private Ext ext; 131 | 132 | public Builder() {} 133 | 134 | public Builder id(final String id) 135 | { 136 | this.id = id; 137 | return this; 138 | } 139 | 140 | public Builder buyerid(final String buyerid) 141 | { 142 | this.buyerid = buyerid; 143 | return this; 144 | } 145 | 146 | public Builder yob(final Integer yob) 147 | { 148 | this.yob = yob; 149 | return this; 150 | } 151 | 152 | public Builder gender(final String gender) 153 | { 154 | this.gender = gender; 155 | return this; 156 | } 157 | 158 | public Builder keywords(final String keywords) 159 | { 160 | this.keywords = keywords; 161 | return this; 162 | } 163 | 164 | public Builder customData(final String customData) 165 | { 166 | this.customData = customData; 167 | return this; 168 | } 169 | 170 | public Builder geo(final Geo geo) 171 | { 172 | this.geo = geo; 173 | return this; 174 | } 175 | 176 | public Builder data(final List data) 177 | { 178 | this.data = data; 179 | return this; 180 | } 181 | 182 | public Builder ext(final Ext ext) 183 | { 184 | this.ext = ext; 185 | return this; 186 | } 187 | 188 | public User build() 189 | { 190 | return new User(id, buyerid, yob, gender, keywords, customData, geo, data, ext); 191 | } 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/AssetRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | import com.metamx.datatypes.openrtb.Video; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class AssetRequest 27 | { 28 | private final Integer id; 29 | private final Integer required; 30 | private final TitleRequest title; 31 | private final ImageRequest img; 32 | private final VideoRequest video; 33 | private final DataRequest data; 34 | private final Ext ext; 35 | 36 | public AssetRequest( 37 | @JsonProperty("id") Integer id, 38 | @JsonProperty("required") Integer required, 39 | @JsonProperty("title") TitleRequest title, 40 | @JsonProperty("img") ImageRequest img, 41 | @JsonProperty("video") VideoRequest video, 42 | @JsonProperty("data") DataRequest data, 43 | @JsonProperty("ext") Ext ext 44 | ) 45 | { 46 | this.id = id; 47 | this.required = required; 48 | this.title = title; 49 | this.img = img; 50 | this.video = video; 51 | this.data = data; 52 | this.ext = ext; 53 | } 54 | 55 | @JsonProperty 56 | public Integer getId() 57 | { 58 | return id; 59 | } 60 | 61 | @JsonProperty 62 | public Integer getRequired() 63 | { 64 | return required; 65 | } 66 | 67 | @JsonProperty 68 | public TitleRequest getTitle() 69 | { 70 | return title; 71 | } 72 | 73 | @JsonProperty 74 | public ImageRequest getImg() 75 | { 76 | return img; 77 | } 78 | 79 | @JsonProperty 80 | public VideoRequest getVideo() 81 | { 82 | return video; 83 | } 84 | 85 | @JsonProperty 86 | public DataRequest getData() 87 | { 88 | return data; 89 | } 90 | 91 | @JsonProperty 92 | public Ext getExt() 93 | { 94 | return ext; 95 | } 96 | 97 | public static Builder builder() 98 | { 99 | return new Builder(); 100 | } 101 | 102 | public static class Builder 103 | { 104 | private Integer id; 105 | private Integer required; 106 | private TitleRequest title; 107 | private ImageRequest img; 108 | private VideoRequest video; 109 | private DataRequest data; 110 | private Ext ext; 111 | 112 | public Builder() {} 113 | 114 | public Builder id(final Integer id) 115 | { 116 | this.id = id; 117 | return this; 118 | } 119 | 120 | public Builder required(final Integer required) 121 | { 122 | this.required = required; 123 | return this; 124 | } 125 | 126 | public Builder title(final TitleRequest title) 127 | { 128 | this.title = title; 129 | return this; 130 | } 131 | 132 | public Builder img(final ImageRequest img) 133 | { 134 | this.img = img; 135 | return this; 136 | } 137 | 138 | public Builder video(final VideoRequest video) 139 | { 140 | this.video = video; 141 | return this; 142 | } 143 | 144 | public Builder data(final DataRequest data) 145 | { 146 | this.data = data; 147 | return this; 148 | } 149 | 150 | public Builder ext(final Ext ext) 151 | { 152 | this.ext = ext; 153 | return this; 154 | } 155 | 156 | public AssetRequest build() 157 | { 158 | return new AssetRequest( 159 | id, 160 | required, 161 | title, 162 | img, 163 | video, 164 | data, 165 | ext 166 | ); 167 | } 168 | } 169 | 170 | } 171 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/AssetResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | import com.metamx.datatypes.openrtb.Video; 24 | 25 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 26 | public class AssetResponse 27 | { 28 | private final Integer id; 29 | private final Integer required; 30 | private final TitleResponse title; 31 | private final ImageResponse img; 32 | private final VideoResponse video; 33 | private final DataResponse data; 34 | private final Link link; 35 | private final Ext ext; 36 | 37 | public AssetResponse( 38 | @JsonProperty("id") Integer id, 39 | @JsonProperty("required") Integer required, 40 | @JsonProperty("title") TitleResponse title, 41 | @JsonProperty("img") ImageResponse img, 42 | @JsonProperty("video") VideoResponse video, 43 | @JsonProperty("data") DataResponse data, 44 | @JsonProperty("link") Link link, 45 | @JsonProperty("ext") Ext ext 46 | ) 47 | { 48 | this.id = id; 49 | this.required = required; 50 | this.title = title; 51 | this.img = img; 52 | this.video = video; 53 | this.data = data; 54 | this.link = link; 55 | this.ext = ext; 56 | } 57 | 58 | @JsonProperty 59 | public Integer getId() 60 | { 61 | return id; 62 | } 63 | 64 | @JsonProperty 65 | public Integer getRequired() 66 | { 67 | return required; 68 | } 69 | 70 | @JsonProperty 71 | public TitleResponse getTitle() 72 | { 73 | return title; 74 | } 75 | 76 | @JsonProperty 77 | public ImageResponse getImg() 78 | { 79 | return img; 80 | } 81 | 82 | @JsonProperty 83 | public VideoResponse getVideo() 84 | { 85 | return video; 86 | } 87 | 88 | @JsonProperty 89 | public DataResponse getData() 90 | { 91 | return data; 92 | } 93 | 94 | @JsonProperty 95 | public Link getLink() 96 | { 97 | return link; 98 | } 99 | 100 | @JsonProperty 101 | public Ext getExt() 102 | { 103 | return ext; 104 | } 105 | 106 | public static Builder builder() 107 | { 108 | return new Builder(); 109 | } 110 | 111 | public static class Builder 112 | { 113 | private Integer id; 114 | private Integer required; 115 | private TitleResponse title; 116 | private ImageResponse img; 117 | private VideoResponse video; 118 | private DataResponse data; 119 | private Link link; 120 | private Ext ext; 121 | 122 | public Builder() {} 123 | 124 | public Builder id(final Integer id) 125 | { 126 | this.id = id; 127 | return this; 128 | } 129 | 130 | public Builder required(final Integer required) 131 | { 132 | this.required = required; 133 | return this; 134 | } 135 | 136 | public Builder title(final TitleResponse title) 137 | { 138 | this.title = title; 139 | return this; 140 | } 141 | 142 | public Builder img(final ImageResponse img) 143 | { 144 | this.img = img; 145 | return this; 146 | } 147 | 148 | public Builder video(final VideoResponse video) 149 | { 150 | this.video = video; 151 | return this; 152 | } 153 | 154 | public Builder data(final DataResponse data) 155 | { 156 | this.data = data; 157 | return this; 158 | } 159 | 160 | public Builder link(final Link link) 161 | { 162 | this.link = link; 163 | return this; 164 | } 165 | 166 | public Builder ext(final Ext ext) 167 | { 168 | this.ext = ext; 169 | return this; 170 | } 171 | 172 | public AssetResponse build() 173 | { 174 | return new AssetResponse( 175 | id, 176 | required, 177 | title, 178 | img, 179 | video, 180 | data, 181 | link, 182 | ext 183 | ); 184 | } 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/DataRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 25 | public class DataRequest 26 | { 27 | private final Integer type; 28 | private final Integer len; 29 | private final Ext ext; 30 | 31 | public DataRequest( 32 | @JsonProperty("type") Integer type, 33 | @JsonProperty("len") Integer len, 34 | @JsonProperty("ext") Ext ext 35 | ) 36 | { 37 | this.type = type; 38 | this.len = len; 39 | this.ext = ext; 40 | } 41 | 42 | @JsonProperty 43 | public Integer getType() 44 | { 45 | return type; 46 | } 47 | 48 | @JsonProperty 49 | public Integer getLen() 50 | { 51 | return len; 52 | } 53 | 54 | @JsonProperty 55 | public Ext getExt() 56 | { 57 | return ext; 58 | } 59 | 60 | public static Builder builder() 61 | { 62 | return new Builder(); 63 | } 64 | 65 | public static class Builder 66 | { 67 | private Integer type; 68 | private Integer len; 69 | private Ext ext; 70 | 71 | public Builder() {} 72 | 73 | public Builder type(final Integer type) 74 | { 75 | this.type = type; 76 | return this; 77 | } 78 | 79 | public Builder len(final Integer len) 80 | { 81 | this.len = len; 82 | return this; 83 | } 84 | 85 | public Builder ext(final Ext ext) 86 | { 87 | this.ext = ext; 88 | return this; 89 | } 90 | 91 | public DataRequest build() 92 | { 93 | return new DataRequest( 94 | type, 95 | len, 96 | ext 97 | ); 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/DataResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 25 | public class DataResponse 26 | { 27 | private final String label; 28 | private final String value; 29 | private final Ext ext; 30 | 31 | public DataResponse( 32 | @JsonProperty("label") String label, 33 | @JsonProperty("value") String value, 34 | @JsonProperty("ext") Ext ext 35 | ) 36 | { 37 | this.label = label; 38 | this.value = value; 39 | this.ext = ext; 40 | } 41 | 42 | @JsonProperty 43 | public String getLabel() 44 | { 45 | return label; 46 | } 47 | 48 | @JsonProperty 49 | public String getValue() 50 | { 51 | return value; 52 | } 53 | 54 | @JsonProperty 55 | public Ext getExt() 56 | { 57 | return ext; 58 | } 59 | 60 | public static Builder builder() 61 | { 62 | return new Builder(); 63 | } 64 | 65 | public static class Builder 66 | { 67 | private String label; 68 | private String value; 69 | private Ext ext; 70 | 71 | public Builder() {} 72 | 73 | public Builder label(final String label) 74 | { 75 | this.label = label; 76 | return this; 77 | } 78 | 79 | public Builder value(final String value) 80 | { 81 | this.value = value; 82 | return this; 83 | } 84 | 85 | public Builder ext(final Ext ext) 86 | { 87 | this.ext = ext; 88 | return this; 89 | } 90 | 91 | public DataResponse build() 92 | { 93 | return new DataResponse( 94 | label, 95 | value, 96 | ext 97 | ); 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/ImageRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | import java.util.List; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class ImageRequest 28 | { 29 | private final Integer type; 30 | private final Integer w; 31 | private final Integer wmin; 32 | private final Integer h; 33 | private final Integer hmin; 34 | private final List mimes; 35 | private final Ext ext; 36 | 37 | public ImageRequest( 38 | @JsonProperty("type") Integer type, 39 | @JsonProperty("w") Integer w, 40 | @JsonProperty("wmin") Integer wmin, 41 | @JsonProperty("h") Integer h, 42 | @JsonProperty("hmin") Integer hmin, 43 | @JsonProperty("mimes") List mimes, 44 | @JsonProperty("ext") Ext ext 45 | ) 46 | { 47 | this.type = type; 48 | this.w = w; 49 | this.wmin = wmin; 50 | this.h = h; 51 | this.hmin = hmin; 52 | this.mimes = mimes; 53 | this.ext = ext; 54 | } 55 | 56 | @JsonProperty 57 | public Integer getType() 58 | { 59 | return type; 60 | } 61 | 62 | @JsonProperty 63 | public Integer getW() 64 | { 65 | return w; 66 | } 67 | 68 | @JsonProperty 69 | public Integer getWmin() 70 | { 71 | return wmin; 72 | } 73 | 74 | @JsonProperty 75 | public Integer getH() 76 | { 77 | return h; 78 | } 79 | 80 | @JsonProperty 81 | public Integer getHmin() 82 | { 83 | return hmin; 84 | } 85 | 86 | @JsonProperty 87 | public List getMimes() 88 | { 89 | return mimes; 90 | } 91 | 92 | @JsonProperty 93 | public Ext getExt() 94 | { 95 | return ext; 96 | } 97 | 98 | public static Builder builder() 99 | { 100 | return new Builder(); 101 | } 102 | 103 | public static class Builder 104 | { 105 | private Integer type; 106 | private Integer w; 107 | private Integer wmin; 108 | private Integer h; 109 | private Integer hmin; 110 | private List mimes; 111 | private Ext ext; 112 | 113 | public Builder() {} 114 | 115 | public Builder type(final Integer type) 116 | { 117 | this.type = type; 118 | return this; 119 | } 120 | 121 | public Builder w(final Integer w) 122 | { 123 | this.w = w; 124 | return this; 125 | } 126 | 127 | public Builder wmin(final Integer wmin) 128 | { 129 | this.wmin = wmin; 130 | return this; 131 | } 132 | 133 | public Builder h(final Integer h) 134 | { 135 | this.h = h; 136 | return this; 137 | } 138 | 139 | public Builder hmin(final Integer hmin) 140 | { 141 | this.hmin = hmin; 142 | return this; 143 | } 144 | 145 | public Builder mimes(final List mime) 146 | { 147 | this.mimes = mime; 148 | return this; 149 | } 150 | 151 | public Builder ext(final Ext ext) 152 | { 153 | this.ext = ext; 154 | return this; 155 | } 156 | 157 | public ImageRequest build() 158 | { 159 | return new ImageRequest( 160 | type, 161 | w, 162 | wmin, 163 | h, 164 | hmin, 165 | mimes, 166 | ext 167 | ); 168 | } 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/ImageResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | import java.util.List; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class ImageResponse 28 | { 29 | private final String url; 30 | private final Integer w; 31 | private final Integer h; 32 | private final Ext ext; 33 | 34 | public ImageResponse( 35 | @JsonProperty("url") String url, 36 | @JsonProperty("w") Integer w, 37 | @JsonProperty("h") Integer h, 38 | @JsonProperty("ext") Ext ext 39 | ) 40 | { 41 | this.url = url; 42 | this.w = w; 43 | this.h = h; 44 | this.ext = ext; 45 | } 46 | 47 | @JsonProperty 48 | public String getUrl() { return url; } 49 | 50 | @JsonProperty 51 | public Integer getW() 52 | { 53 | return w; 54 | } 55 | 56 | @JsonProperty 57 | public Integer getH() 58 | { 59 | return h; 60 | } 61 | 62 | @JsonProperty 63 | public Ext getExt() 64 | { 65 | return ext; 66 | } 67 | 68 | public static Builder builder() 69 | { 70 | return new Builder(); 71 | } 72 | 73 | public static class Builder 74 | { 75 | private String url; 76 | private Integer w; 77 | private Integer h; 78 | private Ext ext; 79 | 80 | public Builder() {} 81 | 82 | public Builder url(final String url) 83 | { 84 | this.url = url; 85 | return this; 86 | } 87 | 88 | public Builder w(final Integer w) 89 | { 90 | this.w = w; 91 | return this; 92 | } 93 | 94 | public Builder h(final Integer h) 95 | { 96 | this.h = h; 97 | return this; 98 | } 99 | 100 | public Builder ext(final Ext ext) 101 | { 102 | this.ext = ext; 103 | return this; 104 | } 105 | 106 | public ImageResponse build() 107 | { 108 | return new ImageResponse( 109 | url, 110 | w, 111 | h, 112 | ext 113 | ); 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/Link.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | import java.util.List; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class Link 28 | { 29 | private final String url; 30 | private final List clicktrackers; 31 | private final String fallback; 32 | private final Ext ext; 33 | 34 | public Link( 35 | @JsonProperty("url") String url, 36 | @JsonProperty("clicktrackers") List clicktrackers, 37 | @JsonProperty("fallback") String fallback, 38 | @JsonProperty("ext") Ext ext 39 | ) 40 | { 41 | this.url = url; 42 | this.clicktrackers = clicktrackers; 43 | this.fallback = fallback; 44 | this.ext = ext; 45 | } 46 | 47 | @JsonProperty 48 | public String getUrl() 49 | { 50 | return url; 51 | } 52 | 53 | @JsonProperty 54 | public List getClicktrackers() 55 | { 56 | return clicktrackers; 57 | } 58 | 59 | @JsonProperty 60 | public String getFallback() 61 | { 62 | return fallback; 63 | } 64 | 65 | @JsonProperty 66 | public Ext getExt() 67 | { 68 | return ext; 69 | } 70 | 71 | public static Builder builder() 72 | { 73 | return new Builder(); 74 | } 75 | 76 | public static class Builder 77 | { 78 | private String url; 79 | private List clicktrackers; 80 | private String fallback; 81 | private Ext ext; 82 | 83 | public Builder() {} 84 | 85 | public Builder url(final String url) 86 | { 87 | this.url = url; 88 | return this; 89 | } 90 | 91 | public Builder clicktrackers(final List clicktrackers) 92 | { 93 | this.clicktrackers = clicktrackers; 94 | return this; 95 | } 96 | 97 | public Builder fallback(final String fallback) 98 | { 99 | this.fallback = fallback; 100 | return this; 101 | } 102 | 103 | public Builder ext(final Ext ext) 104 | { 105 | this.ext = ext; 106 | return this; 107 | } 108 | 109 | public Link build() 110 | { 111 | return new Link( 112 | url, 113 | clicktrackers, 114 | fallback, 115 | ext 116 | ); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/NativeAdCreative.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 24 | public class NativeAdCreative 25 | { 26 | private final NativeResponse nativeobj; 27 | 28 | public NativeAdCreative( 29 | @JsonProperty("native") NativeResponse nativeobj 30 | ) 31 | { 32 | this.nativeobj = nativeobj; 33 | } 34 | 35 | @JsonProperty("native") 36 | public NativeResponse getNativeobj() 37 | { 38 | return nativeobj; 39 | } 40 | 41 | public static Builder builder() 42 | { 43 | return new Builder(); 44 | } 45 | 46 | public static class Builder 47 | { 48 | private NativeResponse nativeobj; 49 | 50 | public Builder() {} 51 | 52 | public Builder nativeobj(final NativeResponse nativeobj) 53 | { 54 | this.nativeobj = nativeobj; 55 | return this; 56 | } 57 | 58 | public NativeAdCreative build() 59 | { 60 | return new NativeAdCreative( 61 | nativeobj 62 | ); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/NativeRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | import java.util.List; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class NativeRequest 28 | { 29 | private final String ver; 30 | private final Integer layout; 31 | private final Integer adunit; 32 | private final Integer plcmtcnt; 33 | private final Integer seq; 34 | private final List assets; 35 | private final Ext ext; 36 | 37 | public NativeRequest( 38 | @JsonProperty("ver") String ver, 39 | @JsonProperty("layout") Integer layout, 40 | @JsonProperty("adunit") Integer adunit, 41 | @JsonProperty("plcmtcnt") Integer plcmtcnt, 42 | @JsonProperty("seq") Integer seq, 43 | @JsonProperty("assets") List assets, 44 | @JsonProperty("ext") Ext ext 45 | ) 46 | { 47 | this.ver = ver; 48 | this.layout = layout; 49 | this.adunit = adunit; 50 | this.plcmtcnt = plcmtcnt; 51 | this.seq = seq; 52 | this.assets = assets; 53 | this.ext = ext; 54 | } 55 | 56 | @JsonProperty 57 | public String getVer() 58 | { 59 | return ver; 60 | } 61 | 62 | @JsonProperty 63 | public Integer getLayout() 64 | { 65 | return layout; 66 | } 67 | 68 | @JsonProperty 69 | public Integer getAdunit() 70 | { 71 | return adunit; 72 | } 73 | 74 | @JsonProperty 75 | public Integer getPlcmtcnt() 76 | { 77 | return plcmtcnt; 78 | } 79 | 80 | @JsonProperty 81 | public Integer getSeq() 82 | { 83 | return seq; 84 | } 85 | 86 | @JsonProperty 87 | public List getAssets() 88 | { 89 | return assets; 90 | } 91 | 92 | @JsonProperty 93 | public Ext getExt() 94 | { 95 | return ext; 96 | } 97 | 98 | public static Builder builder() 99 | { 100 | return new Builder(); 101 | } 102 | 103 | public static class Builder 104 | { 105 | private String ver; 106 | private Integer layout; 107 | private Integer adunit; 108 | private Integer plcmtcnt; 109 | private Integer seq; 110 | private List assets; 111 | private Ext ext; 112 | 113 | public Builder() {} 114 | 115 | public Builder ver(final String ver) 116 | { 117 | this.ver = ver; 118 | return this; 119 | } 120 | 121 | public Builder layout(final Integer layout) 122 | { 123 | this.layout = layout; 124 | return this; 125 | } 126 | 127 | public Builder adunit(final Integer adunit) 128 | { 129 | this.adunit = adunit; 130 | return this; 131 | } 132 | 133 | public Builder plcmtcnt (final Integer plcmtcnt) 134 | { 135 | this.plcmtcnt = plcmtcnt; 136 | return this; 137 | } 138 | 139 | public Builder seq (final Integer seq) 140 | { 141 | this.seq = seq; 142 | return this; 143 | } 144 | 145 | public Builder assets(final List assets) 146 | { 147 | this.assets = assets; 148 | return this; 149 | } 150 | 151 | public Builder ext(final Ext ext) 152 | { 153 | this.ext = ext; 154 | return this; 155 | } 156 | 157 | public NativeRequest build() 158 | { 159 | return new NativeRequest( 160 | ver, 161 | layout, 162 | adunit, 163 | plcmtcnt, 164 | seq, 165 | assets, 166 | ext 167 | ); 168 | } 169 | } 170 | 171 | } 172 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/NativeResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | import java.util.List; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class NativeResponse 28 | { 29 | private final String ver; 30 | private final List assets; 31 | private final Link link; 32 | private final List imptrackers; 33 | private final String jstracker; 34 | private final Ext ext; 35 | 36 | public NativeResponse( 37 | @JsonProperty("ver") String ver, 38 | @JsonProperty("assets") List assets, 39 | @JsonProperty("link") Link link, 40 | @JsonProperty("imptrackers") List imptrackers, 41 | @JsonProperty("jstracker") String jstracker, 42 | @JsonProperty("ext") Ext ext 43 | ) 44 | { 45 | this.ver = ver; 46 | this.assets = assets; 47 | this.link = link; 48 | this.imptrackers = imptrackers; 49 | this.jstracker = jstracker; 50 | this.ext = ext; 51 | } 52 | 53 | @JsonProperty 54 | public String getVer() 55 | { 56 | return ver; 57 | } 58 | 59 | @JsonProperty 60 | public List getAssets() 61 | { 62 | return assets; 63 | } 64 | 65 | @JsonProperty 66 | public Link getLink () 67 | { 68 | return link; 69 | } 70 | 71 | @JsonProperty 72 | public List getImptrackers() 73 | { 74 | return imptrackers; 75 | } 76 | 77 | @JsonProperty 78 | public String getJstracker() 79 | { 80 | return jstracker; 81 | } 82 | 83 | @JsonProperty 84 | public Ext getExt() 85 | { 86 | return ext; 87 | } 88 | 89 | public static Builder builder() 90 | { 91 | return new Builder(); 92 | } 93 | 94 | public static class Builder 95 | { 96 | private String ver; 97 | private List assets; 98 | private Link link; 99 | private List imptrackers; 100 | private String jstracker; 101 | private Ext ext; 102 | 103 | public Builder() {} 104 | 105 | public Builder ver(final String ver) 106 | { 107 | this.ver = ver; 108 | return this; 109 | } 110 | 111 | public Builder assets(final List assets) 112 | { 113 | this.assets = assets; 114 | return this; 115 | } 116 | 117 | public Builder link(final Link link) 118 | { 119 | this.link = link; 120 | return this; 121 | } 122 | 123 | public Builder imptrackers (final List imptrackers) 124 | { 125 | this.imptrackers = imptrackers; 126 | return this; 127 | } 128 | 129 | public Builder jstracker (final String jstracker) 130 | { 131 | this.jstracker = jstracker; 132 | return this; 133 | } 134 | 135 | public Builder ext(final Ext ext) 136 | { 137 | this.ext = ext; 138 | return this; 139 | } 140 | 141 | public NativeResponse build() 142 | { 143 | return new NativeResponse( 144 | ver, 145 | assets, 146 | link, 147 | imptrackers, 148 | jstracker, 149 | ext 150 | ); 151 | } 152 | } 153 | 154 | } 155 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/TitleRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 25 | public class TitleRequest 26 | { 27 | private final Integer len; 28 | private final Ext ext; 29 | 30 | public TitleRequest( 31 | @JsonProperty("len") Integer len, 32 | @JsonProperty("ext") Ext ext 33 | ) 34 | { 35 | this.len = len; 36 | this.ext = ext; 37 | } 38 | 39 | @JsonProperty 40 | public Integer getLen() 41 | { 42 | return len; 43 | } 44 | 45 | @JsonProperty 46 | public Ext getExt() 47 | { 48 | return ext; 49 | } 50 | 51 | public static Builder builder() 52 | { 53 | return new Builder(); 54 | } 55 | 56 | public static class Builder 57 | { 58 | private Integer len; 59 | private Ext ext; 60 | 61 | public Builder() {} 62 | 63 | public Builder len(final Integer len) 64 | { 65 | this.len = len; 66 | return this; 67 | } 68 | 69 | public Builder ext(final Ext ext) 70 | { 71 | this.ext = ext; 72 | return this; 73 | } 74 | 75 | public TitleRequest build() 76 | { 77 | return new TitleRequest(len, ext); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/TitleResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 25 | public class TitleResponse 26 | { 27 | private final String text; 28 | private final Ext ext; 29 | 30 | public TitleResponse( 31 | @JsonProperty("text") String text, 32 | @JsonProperty("ext") Ext ext 33 | ) 34 | { 35 | this.text = text; 36 | this.ext = ext; 37 | } 38 | 39 | @JsonProperty 40 | public String getText() 41 | { 42 | return text; 43 | } 44 | 45 | @JsonProperty 46 | public Ext getExt() 47 | { 48 | return ext; 49 | } 50 | 51 | public static Builder builder() 52 | { 53 | return new Builder(); 54 | } 55 | 56 | public static class Builder 57 | { 58 | private String text; 59 | private Ext ext; 60 | 61 | public Builder() {} 62 | 63 | public Builder text(final String text) 64 | { 65 | this.text = text; 66 | return this; 67 | } 68 | 69 | public Builder ext(final Ext ext) 70 | { 71 | this.ext = ext; 72 | return this; 73 | } 74 | 75 | public TitleResponse build() 76 | { 77 | return new TitleResponse(text, ext); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/VideoRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | import java.util.List; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class VideoRequest 28 | { 29 | private final List mimes; 30 | private final Integer minduration; 31 | private final Integer maxduration; 32 | private final List protocols; 33 | private final Ext ext; 34 | 35 | public VideoRequest( 36 | @JsonProperty("mimes") List mimes, 37 | @JsonProperty("minduration") Integer minduration, 38 | @JsonProperty("maxduration") Integer maxduration, 39 | @JsonProperty("protocols") List protocols, 40 | @JsonProperty("ext") Ext ext 41 | ) 42 | { 43 | this.mimes = mimes; 44 | this.minduration = minduration; 45 | this.maxduration = maxduration; 46 | this.protocols = protocols; 47 | this.ext = ext; 48 | } 49 | 50 | @JsonProperty 51 | public List getMimes() 52 | { 53 | return mimes; 54 | } 55 | 56 | @JsonProperty 57 | public Integer getMinduration() 58 | { 59 | return minduration; 60 | } 61 | 62 | @JsonProperty 63 | public Integer getMaxduration() 64 | { 65 | return maxduration; 66 | } 67 | 68 | @JsonProperty 69 | public List getProtocols() 70 | { 71 | return protocols; 72 | } 73 | 74 | @JsonProperty 75 | public Ext getExt() 76 | { 77 | return ext; 78 | } 79 | 80 | public static Builder builder() 81 | { 82 | return new Builder(); 83 | } 84 | 85 | public static class Builder 86 | { 87 | private List mimes; 88 | private Integer minduration; 89 | private Integer maxduration; 90 | private List protocols; 91 | private Ext ext; 92 | 93 | public Builder() {} 94 | 95 | public Builder mimes(final List mimes) 96 | { 97 | this.mimes = mimes; 98 | return this; 99 | } 100 | 101 | public Builder minduration(final Integer minduration) 102 | { 103 | this.minduration = minduration; 104 | return this; 105 | } 106 | 107 | public Builder maxduration(final Integer maxduration) 108 | { 109 | this.maxduration = maxduration; 110 | return this; 111 | } 112 | 113 | public Builder protocols(final List protocols) 114 | { 115 | this.protocols = protocols; 116 | return this; 117 | } 118 | 119 | public Builder ext(final Ext ext) 120 | { 121 | this.ext = ext; 122 | return this; 123 | } 124 | 125 | public VideoRequest build() 126 | { 127 | return new VideoRequest( 128 | mimes, 129 | minduration, 130 | maxduration, 131 | protocols, 132 | ext 133 | ); 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/metamx/datatypes/openrtbnative/VideoResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.annotation.JsonInclude; 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import com.metamx.datatypes.openrtb.Ext; 23 | 24 | import java.util.List; 25 | 26 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 27 | public class VideoResponse 28 | { 29 | private final String vasttag; 30 | 31 | public VideoResponse( 32 | @JsonProperty("vasttag") String vasttag 33 | ) 34 | { 35 | this.vasttag = vasttag; 36 | } 37 | 38 | @JsonProperty 39 | public String getVasttag() 40 | { 41 | return vasttag; 42 | } 43 | 44 | public static Builder builder() 45 | { 46 | return new Builder(); 47 | } 48 | 49 | public static class Builder 50 | { 51 | private String vasttag; 52 | 53 | public Builder() {} 54 | 55 | public Builder vasttag(final String vasttag) 56 | { 57 | this.vasttag = vasttag; 58 | return this; 59 | } 60 | 61 | public VideoResponse build() 62 | { 63 | return new VideoResponse( 64 | vasttag 65 | ); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/test/java/com/metamx/datatypes/mmx/DealsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.mmx; 19 | 20 | import com.fasterxml.jackson.databind.DeserializationFeature; 21 | import com.fasterxml.jackson.databind.ObjectMapper; 22 | import com.metamx.datatypes.openrtb.Banner; 23 | import com.metamx.datatypes.openrtb.Deals; 24 | import com.metamx.datatypes.openrtb.Imp; 25 | import com.metamx.datatypes.openrtb.Pmp; 26 | import org.joda.time.DateTime; 27 | import org.junit.Assert; 28 | import org.junit.Test; 29 | 30 | import java.util.Arrays; 31 | 32 | public class DealsTest 33 | { 34 | final MmxAuctionSummary auctionSummaryWithDeals = MmxAuctionSummary 35 | .builder() 36 | .timestamp(new DateTime("2014-01-01T00:00:00.000Z")) 37 | .impressions( 38 | Arrays.asList( 39 | Imp.builder() 40 | .tagId("231") 41 | .bidFloor(0.1) 42 | .secure(0) 43 | .banner( 44 | Banner.builder().height(320).width(50).pos(3).api(Arrays.asList(3, 4)).build() 45 | ) 46 | .displayManager("MyRenderer") 47 | .displayManagerVer("v2") 48 | .pmp( 49 | Pmp.builder() 50 | .privateAuction(1) 51 | .deals( 52 | Arrays.asList( 53 | Deals.builder() 54 | .id("123ABC") 55 | .auctionType(1) 56 | .bidFloor(1.0) 57 | .bidFloorCur("USD") 58 | .wseat(Arrays.asList("1", "23", "456")) 59 | .wadomain(Arrays.asList("unicornsay.com", "unicornssay.com")) 60 | .build(), 61 | Deals.builder() 62 | .id("ABC12") 63 | .auctionType(1) 64 | .build() 65 | ) 66 | ).build() 67 | ).build() 68 | ) 69 | ).build(); 70 | 71 | final String simpleJson = "{" 72 | + "\"timestamp\":\"2014-01-01T00:00:00.000Z\"," 73 | + "\"imp\":[{\"banner\":{\"w\":50,\"h\":320,\"pos\":3,\"api\":[3,4]},\"displaymanager\":\"MyRenderer\",\"displaymanagerver\":\"v2\",\"tagid\":\"231\",\"bidfloor\":0.1,\"secure\":0,\"pmp\":{\"private_auction\":1,\"deals\":[{\"id\":\"123ABC\",\"bidfloor\":1.0,\"bidfloorcur\":\"USD\",\"wseat\":[\"1\",\"23\",\"456\"],\"wadomain\":[\"unicornsay.com\",\"unicornssay.com\"],\"at\":1},{\"id\":\"ABC12\",\"at\":1}]}}]" 74 | + "}"; 75 | 76 | @Test 77 | public void testSimpleSerialization() throws Exception 78 | { 79 | final ObjectMapper objectMapper = new ObjectMapper(); 80 | System.out.println(objectMapper.writeValueAsString(auctionSummaryWithDeals)); 81 | Assert.assertEquals(simpleJson, objectMapper.writeValueAsString(auctionSummaryWithDeals)); 82 | } 83 | 84 | @Test 85 | public void testSimpleRoundTrip() throws Exception 86 | { 87 | final ObjectMapper objectMapper = new ObjectMapper(); 88 | final String roundTripJson = objectMapper.writeValueAsString( 89 | objectMapper.readValue( 90 | simpleJson, 91 | MmxAuctionSummary.class 92 | ) 93 | ); 94 | Assert.assertEquals(simpleJson, roundTripJson); 95 | } 96 | 97 | @Test 98 | public void testSimpleDeserialization() throws Exception 99 | { 100 | final ObjectMapper objectMapper = new ObjectMapper(); 101 | objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); 102 | final MmxAuctionSummary auction = objectMapper.readValue( 103 | simpleJson, 104 | MmxAuctionSummary.class 105 | ); 106 | final String dealId = auction.getImpressions().get(0).getPmp().getDeals().get(0).getId(); 107 | Assert.assertEquals("123ABC", dealId); 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/test/java/com/metamx/datatypes/mmx/WriteNewLinesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.mmx; 19 | 20 | import com.fasterxml.jackson.databind.DeserializationFeature; 21 | import com.fasterxml.jackson.databind.ObjectMapper; 22 | import com.metamx.datatypes.mmx.MmxAuctionSummary; 23 | import org.joda.time.DateTime; 24 | import org.junit.Assert; 25 | import org.junit.Test; 26 | 27 | import java.io.ByteArrayOutputStream; 28 | import java.io.OutputStream; 29 | import java.util.Arrays; 30 | import java.util.List; 31 | 32 | public class WriteNewLinesTest 33 | { 34 | final MmxAuctionSummary sampleAuction1 = MmxAuctionSummary 35 | .builder() 36 | .timestamp(new DateTime("2014-01-01T00:00:00.000Z")).auctionType(2).build(); 37 | final MmxAuctionSummary sampleAuction2 = MmxAuctionSummary 38 | .builder() 39 | .timestamp(new DateTime("2014-01-01T01:00:00.000Z")).auctionType(1).build(); 40 | 41 | final String outputString = "{\"timestamp\":\"2014-01-01T00:00:00.000Z\",\"at\":2}\n" 42 | + "{\"timestamp\":\"2014-01-01T01:00:00.000Z\",\"at\":1}\n"; 43 | 44 | @Test 45 | public void testSimpleDeserialization() throws Exception 46 | { 47 | List auctionList = Arrays.asList(sampleAuction1, sampleAuction2); 48 | final String separator = "\n"; 49 | 50 | final ObjectMapper objectMapper = new ObjectMapper(); 51 | objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); 52 | final OutputStream outStream = new ByteArrayOutputStream(); 53 | 54 | for (MmxAuctionSummary auction : auctionList) { 55 | outStream.write(objectMapper.writeValueAsBytes(auction)); 56 | outStream.write(separator.getBytes()); 57 | } 58 | 59 | Assert.assertEquals(outputString, outStream.toString()); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/test/java/com/metamx/datatypes/openrtb/BidResponseTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtb; 19 | 20 | import com.fasterxml.jackson.databind.ObjectMapper; 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | 24 | import java.util.Arrays; 25 | 26 | public class BidResponseTest 27 | { 28 | 29 | final Ext sampleExt = Ext.builder() 30 | .put("sample_str", "Test String") 31 | .put("sample_int", 1) 32 | .put("sample_double",2.0) 33 | .put("sample_str_list", Arrays.asList("test1", "test2")) 34 | .build(); 35 | 36 | final Bid sampleBid = Bid.builder() 37 | .id("1") 38 | .impId("102") 39 | .price(5.43) 40 | .adId("314") 41 | .nurl("unicornssay.com") 42 | .adm("XHTML markup") 43 | .adomain(Arrays.asList("realtime4real.mmx.org")) 44 | .iUrl("http://adserver.com/pathtosampleimage") 45 | .cId("229") 46 | .crId("1234") 47 | .attr(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 12)) 48 | .dealId("123Deal") 49 | .height(320) 50 | .width(50) 51 | .ext(sampleExt) 52 | .build(); 53 | 54 | final SeatBid sampleSeatBid = SeatBid.builder() 55 | .seat("512") 56 | .bid(Arrays.asList(sampleBid)) 57 | .group(1) 58 | .ext(sampleExt) 59 | .build(); 60 | 61 | final BidResponse sampleBidResponse = BidResponse.builder() 62 | .id("123ABC") 63 | .seatBid(Arrays.asList(sampleSeatBid)) 64 | .bidId("1234ABCD") 65 | .cur("USD") 66 | .customData("customID123") 67 | .nbr(0) 68 | .ext(sampleExt) 69 | .build(); 70 | 71 | @Test 72 | public void printJson() throws Exception 73 | { 74 | final ObjectMapper objectMapper = new ObjectMapper(); 75 | System.out.println(objectMapper.writeValueAsString(sampleExt)); 76 | } 77 | 78 | final String extJson = "{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}"; 79 | final String bidJson = "{\"id\":\"1\",\"impid\":\"102\",\"price\":5.43,\"adid\":\"314\",\"nurl\":\"unicornssay.com\",\"adm\":\"XHTML markup\",\"adomain\":[\"realtime4real.mmx.org\"],\"iurl\":\"http://adserver.com/pathtosampleimage\",\"cid\":\"229\",\"crid\":\"1234\",\"attr\":[1,2,3,4,5,6,7,12],\"dealid\":\"123Deal\",\"h\":320,\"w\":50,\"ext\":{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}}"; 80 | final String seatBidJson = "{\"seat\":\"512\",\"bid\":[{\"id\":\"1\",\"impid\":\"102\",\"price\":5.43,\"adid\":\"314\",\"nurl\":\"unicornssay.com\",\"adm\":\"XHTML markup\",\"adomain\":[\"realtime4real.mmx.org\"],\"iurl\":\"http://adserver.com/pathtosampleimage\",\"cid\":\"229\",\"crid\":\"1234\",\"attr\":[1,2,3,4,5,6,7,12],\"dealid\":\"123Deal\",\"h\":320,\"w\":50,\"ext\":{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}}],\"group\":1,\"ext\":{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}}"; 81 | final String bidResponseJson = "{\"id\":\"123ABC\",\"seatbid\":[{\"seat\":\"512\",\"bid\":[{\"id\":\"1\",\"impid\":\"102\",\"price\":5.43,\"adid\":\"314\",\"nurl\":\"unicornssay.com\",\"adm\":\"XHTML markup\",\"adomain\":[\"realtime4real.mmx.org\"],\"iurl\":\"http://adserver.com/pathtosampleimage\",\"cid\":\"229\",\"crid\":\"1234\",\"attr\":[1,2,3,4,5,6,7,12],\"dealid\":\"123Deal\",\"h\":320,\"w\":50,\"ext\":{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}}],\"group\":1,\"ext\":{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}}],\"bidid\":\"1234ABCD\",\"cur\":\"USD\",\"customdata\":\"customID123\",\"nbr\":0,\"ext\":{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}}"; 82 | 83 | @Test 84 | public void testSerializationByObject() throws Exception 85 | { 86 | final ObjectMapper objectMapper = new ObjectMapper(); 87 | 88 | Assert.assertEquals(extJson, objectMapper.writeValueAsString(sampleExt)); 89 | Assert.assertEquals(bidJson, objectMapper.writeValueAsString(sampleBid)); 90 | Assert.assertEquals(seatBidJson, objectMapper.writeValueAsString(sampleSeatBid)); 91 | Assert.assertEquals(bidResponseJson, objectMapper.writeValueAsString(sampleBidResponse)); 92 | 93 | } 94 | 95 | @Test 96 | public void testRoundTripByObject() throws Exception 97 | { 98 | final ObjectMapper objectMapper = new ObjectMapper(); 99 | 100 | final String roundTripExtJson = objectMapper.writeValueAsString( 101 | objectMapper.readValue(extJson, Ext.class) 102 | ); 103 | Assert.assertEquals(extJson, roundTripExtJson); 104 | 105 | final String roundTripBidJson = objectMapper.writeValueAsString( 106 | objectMapper.readValue(bidJson, Bid.class) 107 | ); 108 | Assert.assertEquals(bidJson, roundTripBidJson); 109 | 110 | final String roundTripSeatBidJson = objectMapper.writeValueAsString( 111 | objectMapper.readValue(seatBidJson, SeatBid.class) 112 | ); 113 | Assert.assertEquals(seatBidJson, roundTripSeatBidJson); 114 | 115 | final String roundTripBidResponseJson = objectMapper.writeValueAsString( 116 | objectMapper.readValue(bidResponseJson, BidResponse.class) 117 | ); 118 | Assert.assertEquals(bidResponseJson, roundTripBidResponseJson); 119 | 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/test/java/com/metamx/datatypes/openrtbnative/NativeRequestTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.databind.ObjectMapper; 21 | import com.metamx.datatypes.openrtb.App; 22 | import com.metamx.datatypes.openrtb.Banner; 23 | import com.metamx.datatypes.openrtb.BidRequest; 24 | import com.metamx.datatypes.openrtb.Content; 25 | import com.metamx.datatypes.openrtb.Data; 26 | import com.metamx.datatypes.openrtb.Deals; 27 | import com.metamx.datatypes.openrtb.Device; 28 | import com.metamx.datatypes.openrtb.Ext; 29 | import com.metamx.datatypes.openrtb.Geo; 30 | import com.metamx.datatypes.openrtb.Imp; 31 | import com.metamx.datatypes.openrtb.Pmp; 32 | import com.metamx.datatypes.openrtb.Producer; 33 | import com.metamx.datatypes.openrtb.Publisher; 34 | import com.metamx.datatypes.openrtb.Regs; 35 | import com.metamx.datatypes.openrtb.Segment; 36 | import com.metamx.datatypes.openrtb.Site; 37 | import com.metamx.datatypes.openrtb.User; 38 | import com.metamx.datatypes.openrtb.Video; 39 | import org.junit.Assert; 40 | import org.junit.Test; 41 | 42 | import java.util.Arrays; 43 | 44 | public class NativeRequestTest 45 | { 46 | 47 | final Ext sampleExt = Ext.builder() 48 | .put("sample_str", "Test String") 49 | .put("sample_int", 1) 50 | .put("sample_double", 2.0) 51 | .put("sample_str_list", Arrays.asList("test1", "test2")) 52 | .build(); 53 | 54 | final TitleRequest sampleTitle = TitleRequest.builder() 55 | .len(32) 56 | .build(); 57 | 58 | final ImageRequest sampleImage = ImageRequest.builder() 59 | .type(4) 60 | .w(200) 61 | .wmin(180) 62 | .h(320) 63 | .hmin(300) 64 | .mimes(Arrays.asList("image/jpg","image/gif")) 65 | .build(); 66 | 67 | final VideoRequest sampleVideo = VideoRequest.builder() 68 | .mimes(Arrays.asList("image/jpg", "image/gif")) 69 | .minduration(4) 70 | .maxduration(40) 71 | .protocols(Arrays.asList(4, 5)) 72 | .build(); 73 | 74 | final DataRequest sampleData = DataRequest.builder() 75 | .type(3) 76 | .len(32) 77 | .build(); 78 | 79 | final AssetRequest sampleAssets = AssetRequest.builder() 80 | .id(35) 81 | .required(0) 82 | .title(sampleTitle) 83 | .img(sampleImage) 84 | .video(sampleVideo) 85 | .data(sampleData) 86 | .build(); 87 | 88 | final NativeRequest sampleNative = NativeRequest.builder() 89 | .ver("1") 90 | .layout(5) 91 | .adunit(2) 92 | .plcmtcnt(8) 93 | .seq(0) 94 | .assets( 95 | Arrays.asList( 96 | AssetRequest.builder() 97 | .id(35) 98 | .required(0) 99 | .title(sampleTitle) 100 | .img(sampleImage) 101 | .video(sampleVideo) 102 | .data(sampleData) 103 | .build() 104 | ) 105 | ) 106 | .ext(sampleExt) 107 | .build(); 108 | 109 | @Test 110 | public void printJson() throws Exception 111 | { 112 | final ObjectMapper objectMapper = new ObjectMapper(); 113 | System.out.println(objectMapper.writeValueAsString(sampleNative)); 114 | } 115 | 116 | final String extJson = "{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}"; 117 | final String titleJson = "{\"len\":32}"; 118 | final String imageJson = "{\"type\":4,\"w\":200,\"wmin\":180,\"h\":320,\"hmin\":300,\"mimes\":[\"image/jpg\",\"image/gif\"]}"; 119 | final String videoJson = "{\"mimes\":[\"image/jpg\",\"image/gif\"],\"minduration\":4,\"maxduration\":40,\"protocols\":[4,5]}"; 120 | final String dataJson = "{\"type\":3,\"len\":32}"; 121 | final String assetsJson = "{\"id\":35,\"required\":0,\"title\":{\"len\":32},\"img\":{\"type\":4,\"w\":200,\"wmin\":180,\"h\":320,\"hmin\":300,\"mimes\":[\"image/jpg\",\"image/gif\"]},\"video\":{\"mimes\":[\"image/jpg\",\"image/gif\"],\"minduration\":4,\"maxduration\":40,\"protocols\":[4,5]},\"data\":{\"type\":3,\"len\":32}}"; 122 | 123 | final String nativeJson = "{\"ver\":\"1\",\"layout\":5,\"adunit\":2,\"plcmtcnt\":8,\"seq\":0,\"assets\":[{\"id\":35,\"required\":0,\"title\":{\"len\":32},\"img\":{\"type\":4,\"w\":200,\"wmin\":180,\"h\":320,\"hmin\":300,\"mimes\":[\"image/jpg\",\"image/gif\"]},\"video\":{\"mimes\":[\"image/jpg\",\"image/gif\"],\"minduration\":4,\"maxduration\":40,\"protocols\":[4,5]},\"data\":{\"type\":3,\"len\":32}}],\"ext\":{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}}"; 124 | 125 | @Test 126 | public void testSerializationByObject() throws Exception 127 | { 128 | final ObjectMapper objectMapper = new ObjectMapper(); 129 | 130 | Assert.assertEquals(extJson, objectMapper.writeValueAsString(sampleExt)); 131 | Assert.assertEquals(titleJson, objectMapper.writeValueAsString(sampleTitle)); 132 | Assert.assertEquals(imageJson, objectMapper.writeValueAsString(sampleImage)); 133 | Assert.assertEquals(videoJson, objectMapper.writeValueAsString(sampleVideo)); 134 | Assert.assertEquals(dataJson, objectMapper.writeValueAsString(sampleData)); 135 | Assert.assertEquals(assetsJson, objectMapper.writeValueAsString(sampleAssets)); 136 | Assert.assertEquals(nativeJson, objectMapper.writeValueAsString(sampleNative)); 137 | } 138 | 139 | @Test 140 | public void testRoundTripByObject() throws Exception 141 | { 142 | final ObjectMapper objectMapper = new ObjectMapper(); 143 | 144 | final String roundTripExtJson = objectMapper.writeValueAsString( 145 | objectMapper.readValue(extJson, Ext.class) 146 | ); 147 | Assert.assertEquals(extJson, roundTripExtJson); 148 | 149 | final String roundTripTitleJson = objectMapper.writeValueAsString( 150 | objectMapper.readValue(titleJson, TitleRequest.class) 151 | ); 152 | Assert.assertEquals(titleJson, roundTripTitleJson); 153 | 154 | final String roundTripImageJson = objectMapper.writeValueAsString( 155 | objectMapper.readValue(imageJson, ImageRequest.class) 156 | ); 157 | Assert.assertEquals(imageJson, roundTripImageJson); 158 | 159 | final String roundTripVideoJson = objectMapper.writeValueAsString( 160 | objectMapper.readValue(videoJson, VideoRequest.class) 161 | ); 162 | Assert.assertEquals(videoJson, roundTripVideoJson); 163 | 164 | final String roundTripDataJson = objectMapper.writeValueAsString( 165 | objectMapper.readValue(dataJson, DataRequest.class) 166 | ); 167 | Assert.assertEquals(dataJson, roundTripDataJson); 168 | 169 | final String roundTripAssetsJson = objectMapper.writeValueAsString( 170 | objectMapper.readValue(assetsJson, AssetRequest.class) 171 | ); 172 | Assert.assertEquals(assetsJson, roundTripAssetsJson); 173 | 174 | final String roundTripNativeJson = objectMapper.writeValueAsString( 175 | objectMapper.readValue(nativeJson, NativeRequest.class) 176 | ); 177 | Assert.assertEquals(nativeJson, roundTripNativeJson); 178 | 179 | } 180 | 181 | } 182 | -------------------------------------------------------------------------------- /src/test/java/com/metamx/datatypes/openrtbnative/NativeResponseTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Rad-tech-datatypes. 3 | * Copyright 2014 Metamarkets Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.metamx.datatypes.openrtbnative; 19 | 20 | import com.fasterxml.jackson.databind.ObjectMapper; 21 | import com.metamx.datatypes.openrtb.Ext; 22 | import org.junit.Assert; 23 | import org.junit.Test; 24 | 25 | import java.util.Arrays; 26 | 27 | public class NativeResponseTest 28 | { 29 | 30 | final Ext sampleExt = Ext.builder() 31 | .put("sample_str", "Test String") 32 | .put("sample_int", 1) 33 | .put("sample_double", 2.0) 34 | .put("sample_str_list", Arrays.asList("test1", "test2")) 35 | .build(); 36 | 37 | final TitleResponse sampleTitle = TitleResponse.builder() 38 | .text("threetwo") 39 | .build(); 40 | 41 | final ImageResponse sampleImage = ImageResponse.builder() 42 | .url("4") 43 | .w(200) 44 | .h(320) 45 | .build(); 46 | 47 | final VideoResponse sampleVideo = VideoResponse.builder() 48 | .vasttag("xml") 49 | .build(); 50 | 51 | final DataResponse sampleData = DataResponse.builder() 52 | .label("xz") 53 | .value("49") 54 | .build(); 55 | 56 | final Link sampleLink = Link.builder() 57 | .url("3") 58 | .clicktrackers(Arrays.asList("32", "34")) 59 | .fallback("hah.com") 60 | .build(); 61 | 62 | final AssetResponse sampleAssets = AssetResponse.builder() 63 | .id(35) 64 | .required(0) 65 | .title(sampleTitle) 66 | .img(sampleImage) 67 | .video(sampleVideo) 68 | .data(sampleData) 69 | .link(sampleLink) 70 | .build(); 71 | 72 | final NativeResponse sampleNative = NativeResponse.builder() 73 | .ver("1") 74 | .assets( 75 | Arrays.asList( 76 | AssetResponse.builder() 77 | .id(35) 78 | .required(0) 79 | .title(sampleTitle) 80 | .img(sampleImage) 81 | .video(sampleVideo) 82 | .data(sampleData) 83 | .build() 84 | ) 85 | ) 86 | .link(sampleLink) 87 | .imptrackers(Arrays.asList("abc","1234")) 88 | .jstracker("8") 89 | .ext(sampleExt) 90 | .build(); 91 | 92 | final NativeAdCreative sampleCreative = NativeAdCreative.builder() 93 | .nativeobj(sampleNative) 94 | .build(); 95 | 96 | @Test 97 | public void printJson() throws Exception 98 | { 99 | final ObjectMapper objectMapper = new ObjectMapper(); 100 | System.out.println(objectMapper.writeValueAsString(sampleNative)); 101 | } 102 | 103 | final String extJson = "{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}"; 104 | final String titleJson = "{\"text\":\"threetwo\"}"; 105 | final String linkJson = "{\"url\":\"3\",\"clicktrackers\":[\"32\",\"34\"],\"fallback\":\"hah.com\"}"; 106 | final String imageJson = "{\"url\":\"4\",\"w\":200,\"h\":320}"; 107 | final String videoJson = "{\"vasttag\":\"xml\"}"; 108 | final String dataJson = "{\"label\":\"xz\",\"value\":\"49\"}"; 109 | final String assetsJson = "{\"id\":35,\"required\":0,\"title\":{\"text\":\"threetwo\"},\"img\":{\"url\":\"4\",\"w\":200,\"h\":320},\"video\":{\"vasttag\":\"xml\"},\"data\":{\"label\":\"xz\",\"value\":\"49\"},\"link\":{\"url\":\"3\",\"clicktrackers\":[\"32\",\"34\"],\"fallback\":\"hah.com\"}}"; 110 | 111 | final String nativeJson = "{\"ver\":\"1\",\"assets\":[{\"id\":35,\"required\":0,\"title\":{\"text\":\"threetwo\"},\"img\":{\"url\":\"4\",\"w\":200,\"h\":320},\"video\":{\"vasttag\":\"xml\"},\"data\":{\"label\":\"xz\",\"value\":\"49\"}}],\"link\":{\"url\":\"3\",\"clicktrackers\":[\"32\",\"34\"],\"fallback\":\"hah.com\"},\"imptrackers\":[\"abc\",\"1234\"],\"jstracker\":\"8\",\"ext\":{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}}"; 112 | 113 | final String creativeJson = "{\"native\":{\"ver\":\"1\",\"assets\":[{\"id\":35,\"required\":0,\"title\":{\"text\":\"threetwo\"},\"img\":{\"url\":\"4\",\"w\":200,\"h\":320},\"video\":{\"vasttag\":\"xml\"},\"data\":{\"label\":\"xz\",\"value\":\"49\"}}],\"link\":{\"url\":\"3\",\"clicktrackers\":[\"32\",\"34\"],\"fallback\":\"hah.com\"},\"imptrackers\":[\"abc\",\"1234\"],\"jstracker\":\"8\",\"ext\":{\"sample_str\":\"Test String\",\"sample_int\":1,\"sample_str_list\":[\"test1\",\"test2\"],\"sample_double\":2.0}}}"; 114 | 115 | @Test 116 | public void testSerializationByObject() throws Exception 117 | { 118 | final ObjectMapper objectMapper = new ObjectMapper(); 119 | 120 | Assert.assertEquals(extJson, objectMapper.writeValueAsString(sampleExt)); 121 | Assert.assertEquals(titleJson, objectMapper.writeValueAsString(sampleTitle)); 122 | Assert.assertEquals(linkJson, objectMapper.writeValueAsString(sampleLink)); 123 | Assert.assertEquals(imageJson, objectMapper.writeValueAsString(sampleImage)); 124 | Assert.assertEquals(videoJson, objectMapper.writeValueAsString(sampleVideo)); 125 | Assert.assertEquals(dataJson, objectMapper.writeValueAsString(sampleData)); 126 | Assert.assertEquals(assetsJson, objectMapper.writeValueAsString(sampleAssets)); 127 | Assert.assertEquals(nativeJson, objectMapper.writeValueAsString(sampleNative)); 128 | 129 | Assert.assertEquals(creativeJson, objectMapper.writeValueAsString(sampleCreative)); 130 | } 131 | 132 | @Test 133 | public void testRoundTripByObject() throws Exception 134 | { 135 | final ObjectMapper objectMapper = new ObjectMapper(); 136 | 137 | final String roundTripExtJson = objectMapper.writeValueAsString( 138 | objectMapper.readValue(extJson, Ext.class) 139 | ); 140 | Assert.assertEquals(extJson, roundTripExtJson); 141 | 142 | final String roundTripTitleJson = objectMapper.writeValueAsString( 143 | objectMapper.readValue(titleJson, TitleResponse.class) 144 | ); 145 | Assert.assertEquals(titleJson, roundTripTitleJson); 146 | 147 | final String roundTripLinkJson = objectMapper.writeValueAsString( 148 | objectMapper.readValue(linkJson, Link.class) 149 | ); 150 | Assert.assertEquals(linkJson, roundTripLinkJson); 151 | 152 | final String roundTripImageJson = objectMapper.writeValueAsString( 153 | objectMapper.readValue(imageJson, ImageResponse.class) 154 | ); 155 | Assert.assertEquals(imageJson, roundTripImageJson); 156 | 157 | final String roundTripVideoJson = objectMapper.writeValueAsString( 158 | objectMapper.readValue(videoJson, VideoResponse.class) 159 | ); 160 | Assert.assertEquals(videoJson, roundTripVideoJson); 161 | 162 | final String roundTripDataJson = objectMapper.writeValueAsString( 163 | objectMapper.readValue(dataJson, DataResponse.class) 164 | ); 165 | Assert.assertEquals(dataJson, roundTripDataJson); 166 | 167 | final String roundTripAssetsJson = objectMapper.writeValueAsString( 168 | objectMapper.readValue(assetsJson, AssetResponse.class) 169 | ); 170 | Assert.assertEquals(assetsJson, roundTripAssetsJson); 171 | 172 | final String roundTripNativeJson = objectMapper.writeValueAsString( 173 | objectMapper.readValue(nativeJson, NativeResponse.class) 174 | ); 175 | Assert.assertEquals(nativeJson, roundTripNativeJson); 176 | 177 | final String roundTripCreativeJson = objectMapper.writeValueAsString( 178 | objectMapper.readValue(creativeJson, NativeAdCreative.class) 179 | ); 180 | Assert.assertEquals(creativeJson, roundTripCreativeJson); 181 | 182 | } 183 | 184 | } 185 | --------------------------------------------------------------------------------