本文整理匯總了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;
}