本文整理汇总了Java中com.google.openrtb.OpenRtb.BidRequest.Imp.hasBanner方法的典型用法代码示例。如果您正苦于以下问题:Java Imp.hasBanner方法的具体用法?Java Imp.hasBanner怎么用?Java Imp.hasBanner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.openrtb.OpenRtb.BidRequest.Imp
的用法示例。
在下文中一共展示了Imp.hasBanner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bannerImpWithId
import com.google.openrtb.OpenRtb.BidRequest.Imp; //导入方法依赖的package包/类
/**
* Find an {@link Imp} by its ID and its {@link Banner}'s ID.
*
* @param impId Imp ID; optional if the Banner IDs are unique within the request
* @param bannerId Banner ID
* @return The {@link Imp} for a given impression ID x banner ID, or {@code null} if not found
*/
@Nullable public static Imp bannerImpWithId(
BidRequest request, @Nullable String impId, String bannerId) {
checkNotNull(bannerId);
for (Imp imp : request.getImpList()) {
if ((impId == null || imp.getId().equals(impId))
&& imp.hasBanner() && imp.getBanner().getId().equals(bannerId)) {
return imp;
}
}
return null;
}
示例2: writeImpFields
import com.google.openrtb.OpenRtb.BidRequest.Imp; //导入方法依赖的package包/类
protected void writeImpFields(Imp imp, JsonGenerator gen) throws IOException {
gen.writeStringField("id", imp.getId());
if (imp.hasBanner()) {
gen.writeFieldName("banner");
writeBanner(imp.getBanner(), gen);
}
if (imp.hasVideo()) {
gen.writeFieldName("video");
writeVideo(imp.getVideo(), gen);
}
if (imp.hasAudio()) {
gen.writeFieldName("audio");
writeAudio(imp.getAudio(), gen);
}
if (imp.hasNative()) {
gen.writeFieldName("native");
writeNative(imp.getNative(), gen);
}
if (imp.hasDisplaymanager()) {
gen.writeStringField("displaymanager", imp.getDisplaymanager());
}
if (imp.hasDisplaymanagerver()) {
gen.writeStringField("displaymanagerver", imp.getDisplaymanagerver());
}
if (imp.hasInstl()) {
writeIntBoolField("instl", imp.getInstl(), gen);
}
if (imp.hasTagid()) {
gen.writeStringField("tagid", imp.getTagid());
}
if (imp.hasBidfloor()) {
gen.writeNumberField("bidfloor", imp.getBidfloor());
}
if (imp.hasBidfloorcur()) {
gen.writeStringField("bidfloorcur", imp.getBidfloorcur());
}
if (imp.hasSecure()) {
writeIntBoolField("secure", imp.getSecure(), gen);
}
writeStrings("iframebuster", imp.getIframebusterList(), gen);
if (imp.hasPmp()) {
gen.writeFieldName("pmp");
writePmp(imp.getPmp(), gen);
}
if (imp.hasClickbrowser()) {
gen.writeBooleanField("clickbrowser", imp.getClickbrowser());
}
if (imp.hasExp()) {
gen.writeNumberField("exp", imp.getExp());
}
if (imp.getMetricCount() != 0) {
gen.writeArrayFieldStart("metric");
for (Metric metric : imp.getMetricList()) {
writeMetric(metric, gen);
}
gen.writeEndArray();
}
}
示例3: validate
import com.google.openrtb.OpenRtb.BidRequest.Imp; //导入方法依赖的package包/类
public boolean validate(BidRequest request, Bid.Builder bid) {
Imp imp = OpenRtbUtils.impWithId(request, bid.getImpid());
if (imp == null) {
unmatchedImp.inc();
if (logger.isDebugEnabled()) {
logger.debug("{} rejected, unmatched impid: {}", logId(bid), bid.getImpid());
}
return false;
}
boolean goodBid = true;
List<String> badAdvs = check(request.getBadvList(), bid.getAdomainList());
if (!badAdvs.isEmpty()) {
if (logger.isDebugEnabled()) {
logger.debug("{} rejected, blocked adomain values: {}", logId(bid), badAdvs);
}
invalidAdv.inc();
goodBid = false;
}
if (imp.hasBanner()) {
goodBid &= validateCreats(bid, check(imp.getBanner().getBattrList(), bid.getAttrList()));
}
if (imp.hasVideo()) {
goodBid &= validateCreats(bid, check(imp.getVideo().getBattrList(), bid.getAttrList()));
goodBid &= validateCompanions(bid, imp.getVideo().getCompanionadList());
}
if (imp.hasAudio()) {
goodBid &= validateCreats(bid, check(imp.getAudio().getBattrList(), bid.getAttrList()));
goodBid &= validateCompanions(bid, imp.getAudio().getCompanionadList());
}
return goodBid;
}