本文整理汇总了Java中org.onosproject.net.meter.Meter.appId方法的典型用法代码示例。如果您正苦于以下问题:Java Meter.appId方法的具体用法?Java Meter.appId怎么用?Java Meter.appId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.meter.Meter
的用法示例。
在下文中一共展示了Meter.appId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encode
import org.onosproject.net.meter.Meter; //导入方法依赖的package包/类
@Override
public ObjectNode encode(Meter meter, CodecContext context) {
checkNotNull(meter, "Meter cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put(ID, meter.id().toString())
.put(LIFE, meter.life())
.put(PACKETS, meter.packetsSeen())
.put(BYTES, meter.bytesSeen())
.put(REFERENCE_COUNT, meter.referenceCount())
.put(UNIT, meter.unit().toString())
.put(BURST, meter.isBurst())
.put(DEVICE_ID, meter.deviceId().toString());
if (meter.appId() != null) {
result.put(APP_ID, meter.appId().toString());
}
if (meter.state() != null) {
result.put(STATE, meter.state().toString());
}
ArrayNode bands = context.mapper().createArrayNode();
meter.bands().forEach(band -> {
ObjectNode bandJson = context.codec(Band.class).encode(band, context);
bands.add(bandJson);
});
result.set(BANDS, bands);
return result;
}
示例2: encode
import org.onosproject.net.meter.Meter; //导入方法依赖的package包/类
@Override
public ObjectNode encode(Meter meter, CodecContext context) {
checkNotNull(meter, "Meter cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put(ID, meter.id().toString())
.put(LIFE, meter.life())
.put(PACKETS, meter.packetsSeen())
.put(BYTES, meter.bytesSeen())
.put(REFERENCE_COUNT, meter.referenceCount())
.put(UNIT, meter.unit().toString())
.put(BURST, meter.isBurst())
.put(DEVICE_ID, meter.deviceId().toString());
if (meter.appId() != null) {
result.put(APP_ID, meter.appId().name());
}
if (meter.state() != null) {
result.put(STATE, meter.state().toString());
}
ArrayNode bands = context.mapper().createArrayNode();
meter.bands().forEach(band -> {
ObjectNode bandJson = context.codec(Band.class).encode(band, context);
bands.add(bandJson);
});
result.set(BANDS, bands);
return result;
}