在OpenRTB Protobuf Java中设置扩展

时间:2016-10-10 07:58:58

标签: java protocol-buffers

如何设置OpenRTB的响应扩展名

OpenRTB.proto @ https://github.com/google/openrtb/blob/master/openrtb-core/src/main/protobuf/openrtb.proto

extension.proto @ https://developers.google.com/ad-exchange/rtb/downloads/openrtb-adx-proto.txt

AdxExt.BidExt.Builder bidExtBuilder = AdxExt.BidExt.newBuilder()
                            .addImpressionTrackingUrl(url);

BidResponse.SeatBid.Bid.Builder seatBidBuilder = BidResponse.SeatBid.Bid.newBuilder()
                    .setId(id)
                    .setImpid(impId)
                    .setPrice(price)
                    .setExtension(AdxExt.bid, bidExtBuilder); // issue here, compile time error


// setExtension signature 
public final <Type> BuilderType setExtension(final Extension<MessageType, Type> extension, final Type value)

setExtension或addExtension方法想要获得什么?是否有与

相关的内容
extend com.google.openrtb.BidResponse.SeatBid.Bid {
    // Extension key for AdX Bid.ext.
    optional BidExt bid = 1014;
}

如何添加BidExt的扩展名,我将一个impression_tracking_url添加到seatBidBuilder中?

参考https://developers.google.com/protocol-buffers/docs/reference/java-generated#extension

1 个答案:

答案 0 :(得分:0)

setExtension(AdxExt.bid,bidExtBuilder。 build());