本文整理匯總了Java中com.google.openrtb.OpenRtb.BidRequest.Builder方法的典型用法代碼示例。如果您正苦於以下問題:Java BidRequest.Builder方法的具體用法?Java BidRequest.Builder怎麽用?Java BidRequest.Builder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.openrtb.OpenRtb.BidRequest
的用法示例。
在下文中一共展示了BidRequest.Builder方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readBidRequestField
import com.google.openrtb.OpenRtb.BidRequest; //導入方法依賴的package包/類
@Override protected void readBidRequestField(
JsonParser par, BidRequest.Builder req, String fieldName)
throws IOException {
switch (fieldName) {
case "crtype": {
req.setExtension(TestExt.crtype, par.getText());
break;
}
default:
super.readBidRequestField(par, req, fieldName);
}
}
示例2: testUpdate
import com.google.openrtb.OpenRtb.BidRequest; //導入方法依賴的package包/類
@Test
public void testUpdate() {
BidRequest.Builder req = BidRequest.newBuilder().setId("0");
ProtoUtils.update(ImmutableList.of(req), reqBuilder -> {
reqBuilder.setAt(AuctionType.FIRST_PRICE);
return true;
});
assertThat(req.getAt()).isSameAs(AuctionType.FIRST_PRICE);
}
示例3: testBuilderConversions
import com.google.openrtb.OpenRtb.BidRequest; //導入方法依賴的package包/類
@Test
public void testBuilderConversions() {
BidRequest.Builder reqBuilder = BidRequest.newBuilder().setId("0");
BidRequest req = reqBuilder.build();
assertThat(ProtoUtils.<BidRequest.Builder, BidRequest>built(reqBuilder)).isEqualTo(req);
assertThat(ProtoUtils.<BidRequest, BidRequest>built(req)).isSameAs(req);
assertThat(ProtoUtils.<BidRequest.Builder, BidRequest>built(null)).isNull();
assertThat(ProtoUtils.builder(req).build()).isEqualTo(reqBuilder.build());
assertThat(ProtoUtils.<BidRequest.Builder, BidRequest.Builder>builder(reqBuilder))
.isSameAs(reqBuilder);
assertThat(ProtoUtils.<BidRequest, BidRequest.Builder>builder(null)).isNull();
}
示例4: readBidRequest
import com.google.openrtb.OpenRtb.BidRequest; //導入方法依賴的package包/類
/**
* Desserializes a {@link BidRequest} from JSON, with a provided {@link JsonParser}
* which allows several choices of input and encoding.
*/
public final BidRequest.Builder readBidRequest(JsonParser par) throws IOException {
if (emptyToNull(par)) {
return null;
}
BidRequest.Builder req = BidRequest.newBuilder();
for (startObject(par); endObject(par); par.nextToken()) {
String fieldName = getCurrentName(par);
if (par.nextToken() != JsonToken.VALUE_NULL) {
readBidRequestField(par, req, fieldName);
}
}
return req;
}