本文整理汇总了Java中io.vertx.core.json.JsonObject.mapTo方法的典型用法代码示例。如果您正苦于以下问题:Java JsonObject.mapTo方法的具体用法?Java JsonObject.mapTo怎么用?Java JsonObject.mapTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.json.JsonObject
的用法示例。
在下文中一共展示了JsonObject.mapTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertObject
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
private static <T> T convertObject(Class<T> objectClass, JsonObject transformedObject) throws APICallException {
try {
return transformedObject.mapTo(objectClass);
} catch (IllegalArgumentException | ClassCastException e) {
throw new APICallException(e);
}
}
示例2: handle
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
@Override
public void handle(String cluster, String data, String from) {
JsonObject dj = new JsonObject(data);
AckMessage ackMessage = dj.mapTo(AckMessage.class);
List<GossipDigest> olders = ackMessage.getOlders();
Map<GossipMember, HeartbeatState> newers = ackMessage.getNewers();
//update local state
if (newers.size() > 0) {
GossipManager.getInstance().apply2LocalState(newers);
}
Map<GossipMember, HeartbeatState> deltaEndpoints = new HashMap<>();
if (olders != null) {
for (GossipDigest d : olders) {
GossipMember member = GossipManager.getInstance().createByDigest(d);
HeartbeatState hb = GossipManager.getInstance().getEndpointMembers().get(member);
if (hb != null) {
deltaEndpoints.put(member, hb);
}
}
}
if (!deltaEndpoints.isEmpty()) {
Ack2Message ack2Message = new Ack2Message(deltaEndpoints);
Buffer ack2Buffer = GossipManager.getInstance().encodeAck2Message(ack2Message);
if (from != null) {
String[] host = from.split(":");
GossipManager.getInstance().getSettings().getMsgService().sendMsg(host[0], Integer.valueOf(host[1]), ack2Buffer);
}
}
}
示例3: handle
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
@Override
public void handle(String cluster, String data, String from) {
JsonObject dj = new JsonObject(data);
GossipMember whoShutdown = dj.mapTo(GossipMember.class);
if (whoShutdown != null) {
GossipManager.getInstance().down(whoShutdown);
}
}
示例4: handle
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
@Override
public void handle(String cluster, String data, String from) {
JsonObject dj = new JsonObject(data);
Ack2Message ack2Message = dj.mapTo(Ack2Message.class);
Map<GossipMember, HeartbeatState> deltaEndpoints = ack2Message.getEndpoints();
GossipManager.getInstance().apply2LocalState(deltaEndpoints);
}