本文整理匯總了Java中io.vertx.core.json.JsonObject.getJsonObject方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonObject.getJsonObject方法的具體用法?Java JsonObject.getJsonObject怎麽用?Java JsonObject.getJsonObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.json.JsonObject
的用法示例。
在下文中一共展示了JsonObject.getJsonObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processOneResult
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
protected void processOneResult(final JsonObject dataChange) {
final JsonObject data = dataChange.getJsonObject("data");
final JsonObject payload = data.getJsonObject("payload");
// We send it off to the eventbus and in any case have the
// final destination header set - just in case
final EventBus eb = this.getVertx().eventBus();
final DeliveryOptions opts = new DeliveryOptions();
this.getListenerConfig().getEventBusAddresses().forEach(destination -> {
opts.addHeader(Constants.BUS_FINAL_DESTINATION, destination);
});
// Intermediate step for deduplication of messages
if (this.useDedupService()) {
eb.publish(this.getListenerConfig().getEventBusDedupAddress(), payload, opts);
} else {
this.getListenerConfig().getEventBusAddresses().forEach(destination -> {
try {
eb.publish(destination, payload, opts);
this.logger.info("Sending to [" + destination + "]:" + payload.toString());
} catch (final Throwable t) {
this.logger.error(t.getMessage(), t);
}
});
}
}
示例2: createFromJSON
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
public static Message createFromJSON (JsonObject json) {
Message message = new Message();
//get header information
message.event = json.getString("event");
String messageID = json.getString("messageID");
int statusCode = json.getInteger("statusCode");
message.type = ResponseType.getByString(json.getString("status"));
message.data = json.getJsonObject("data");
message.ssid = json.getString("ssid");
if (!messageID.isEmpty() && !messageID.equals("none")) {
//get UUID
message.uuid = UUID.fromString(messageID);
}
return message;
}
示例3: processOneResult
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
/**
* @see net.wissel.salesforce.vertx.listener.CometD#processOneResult(io.vertx.core.json.JsonObject)
*/
@Override
protected void processOneResult(JsonObject dataChange) {
final JsonObject data = dataChange.getJsonObject("data");
final JsonObject payload = data.getJsonObject("payload");
final String objectType = payload.getString("ObjectType__c");
// We send it off to the eventbus
final EventBus eb = this.getVertx().eventBus();
this.getListenerConfig().getEventBusAddresses().forEach(destination -> {
try {
eb.publish(destination+objectType, payload);
this.logger.info("Sending to [" + destination+objectType + "]:" + payload.toString());
} catch (final Throwable t) {
this.logger.error(t.getMessage(), t);
}
});
}
示例4: configureBridgeOptions
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
private BridgeOptions configureBridgeOptions(JsonObject config) {
BridgeOptions bridgeOptions = new BridgeOptions();
JsonObject addresses=config.getJsonObject(ADDRESSES);
JsonArray outbounds=addresses.getJsonArray(OUTBOUND);
JsonArray inbounds=addresses.getJsonArray(INBOUND);
outbounds.forEach(o-> addOutboundPermitted(bridgeOptions, (JsonObject) o));
inbounds.forEach(i-> addInboundPermitted(bridgeOptions, (JsonObject) i));
return bridgeOptions;
}
示例5: getResolver
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
private Resolver<T> getResolver(final RoutingContext context,
final Epsilon<T> income) {
/** 1.Read the resolver first **/
final Annotation annotation = income.getAnnotation();
final Class<?> resolverCls = Instance.invoke(annotation, "resolver");
/** 2.Check configured in default **/
if (null == resolverCls) {
/** 3. Old path **/
final JsonObject content = NODE.read();
final String header = context.request().getHeader(HttpHeaders.CONTENT_TYPE);
final String resolver;
if (null == header) {
resolver = content.getString("default");
} else {
final MediaType type = MediaType.valueOf(header);
final JsonObject resolverMap = content.getJsonObject(type.getType());
resolver = resolverMap.getString(type.getSubtype());
}
LOGGER.info(Info.RESOLVER, resolver, header, context.request().absoluteURI());
return Instance.singleton(resolver);
} else {
LOGGER.info(Info.RESOLVER_CONFIG, resolverCls);
return Instance.singleton(resolverCls);
}
}
示例6: visit
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
@Override
public ConcurrentMap<String, VertxOptions> visit(final String... keys)
throws ZeroException {
// 1. Must be the first line, fixed position.
Ensurer.eqLength(getClass(), 0, (Object[]) keys);
// 2. Visit the node for vertx
final JsonObject data = this.NODE.read();
// 3. Vertx node validation.
final JsonObject vertxData = data.getJsonObject(KEY);
LOGGER.info(Info.INF_B_VERIFY, KEY, getClass().getSimpleName(), vertxData);
Fn.shuntZero(() -> Ruler.verify(KEY, vertxData), vertxData);
// 4. Set cluster options
this.clusterOptions = this.clusterTransformer.transform(data.getJsonObject(YKEY_CLUSTERED));
// 5. Transfer Data
return visit(vertxData.getJsonArray(YKEY_INSTANCE));
}
示例7: searchAnnotations
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
/**
* Searches for annotation in the given time range
*
* @param msg
*/
private void searchAnnotations(final Message<JsonObject> msg) {
final JsonObject annotation = msg.body();
LOG.debug("{}\n{}",address, annotation.encodePrettily());
//get the parameter from the request
final String from = annotation.getJsonObject("range").getString("from");
final String to = annotation.getJsonObject("range").getString("to");
final Range range = rangeParser.parse(from, to);
final JsonObject an = annotation.getJsonObject("annotation");
//build the query and find options
final JsonObject annotationQuery = $and(obj(an.getString("query")),
obj("n.begin", $gte(range.getStart())),
obj("n.begin", $lte(range.getEnd())));
final FindOptions findOptions = new FindOptions().setSort(obj("n.begin", 1)).setLimit(1);
//query for annotations and map the result
client.findWithOptions(collectionName, annotationQuery, findOptions, result -> {
if (result.succeeded()) {
msg.reply(result.result()
.stream()
.map(a -> obj().put("annotation", an)
.put("time", a.getJsonObject("n").getLong("begin"))
.put("title", a.getJsonObject("t").getString("name"))
.put("tags", arr()))
.collect(toJsonArray()));
} else {
LOG.error("Annotation query failed", result.cause());
msg.reply(arr());
}
});
}
示例8: getClearJson
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
/**
* 解析支付寶授權後的響應對象,獲取對應簡潔的JSON
*
* @param res 支付寶授權後的響應對象
* @return 簡潔的JSON,不包含簽名及重複的一些字段
*
* @author Leibniz.Hu
*/
private JsonObject getClearJson(AlipayResponse res) {
JsonObject bodyJson = new JsonObject(res.getBody());
if (bodyJson.containsKey("alipay_user_info_share_response")) {
return bodyJson.getJsonObject("alipay_user_info_share_response");
} else if (bodyJson.containsKey("alipay_system_oauth_token_response")) {
return bodyJson.getJsonObject("alipay_system_oauth_token_response");
} else {
return bodyJson;
}
}
示例9: build
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
private static Envelop build(final JsonObject json) {
Envelop envelop = Envelop.ok();
// 1. Headers
if (null != json) {
// 2.Rebuild
if (json.containsKey("data")) {
envelop = Envelop.success(json.getValue("data"));
}
// 3.Header
if (null != json.getValue("header")) {
final MultiMap headers = MultiMap.caseInsensitiveMultiMap();
final JsonObject headerData = json.getJsonObject("header");
for (final String key : headerData.fieldNames()) {
final Object value = headerData.getValue(key);
if (null != value) {
headers.set(key, value.toString());
}
}
envelop.setHeaders(headers);
}
// 4.User
if (null != json.getValue("user")) {
envelop.setUser(new VirtualUser(json.getJsonObject("user")));
}
}
return envelop;
}
示例10: verify
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
/**
* @param wallClses
* @param keysRef
* @return
*/
private JsonObject verify(final Set<Class<?>> wallClses,
final ConcurrentMap<String, Class<?>> keysRef) {
/** Wall duplicated **/
final Set<String> hashs = new HashSet<>();
Observable.fromIterable(wallClses)
.filter(Objects::nonNull)
.map(item -> {
final Annotation annotation = item.getAnnotation(Wall.class);
// Add configuration key into keys;
keysRef.put(Instance.invoke(annotation, "value"), item);
return this.hashPath(annotation);
}).subscribe(hashs::add);
// Duplicated adding.
Fn.flingUp(hashs.size() != wallClses.size(), LOGGER,
WallDuplicatedException.class, getClass(),
wallClses.stream().map(Class::getName).collect(Collectors.toSet()));
/** Shared key does not existing **/
final JsonObject config = NODE.read();
Fn.flingUp(!config.containsKey(KEY), LOGGER,
DynamicKeyMissingException.class, getClass(),
KEY, config);
/** Wall key missing **/
final JsonObject hitted = config.getJsonObject(KEY);
for (final String key : keysRef.keySet()) {
Fn.flingUp(null == hitted || !hitted.containsKey(key), LOGGER,
WallKeyMissingException.class, getClass(),
key, keysRef.get(key));
}
return hitted;
}
示例11: createRecord
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
private Record createRecord(final JsonObject item) {
final String name = item.getString(NAME);
final String host = item.getString(HOST);
final Integer port = item.getInteger(PORT);
final JsonObject meta = item.getJsonObject(META);
return HttpEndpoint.createRecord(
name, host, port, "/*", meta
);
}
示例12: init
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
private void init(final JsonObject raw) {
// Options
initOpts(raw);
// Config
this.endpoint = raw.getString("endpoint");
if (raw.containsKey("config")) {
this.config = raw.getJsonObject("config");
} else {
this.config = new JsonObject();
}
}
示例13: init
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
static <R> R init(final String key,
final Function<JsonObject, R> executor,
final Class<?> clazz) {
final Node<JsonObject> node = Instance.instance(ZeroUniform.class);
final JsonObject options = node.read();
final Annal logger = Annal.get(clazz);
Fn.flingUp(null == options || !options.containsKey(key)
, logger, ConfigKeyMissingException.class,
clazz, key);
final JsonObject config = options.getJsonObject(key);
Fn.flingUp(() -> Ruler.verify(key, config), logger);
return executor.apply(config);
}
示例14: transform
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
@Override
public HttpServerOptions transform(final JsonObject input) {
final JsonObject config = input.getJsonObject(ServerVisitor.YKEY_CONFIG, null);
return Fn.getSemi(null == config, LOGGER,
HttpServerOptions::new,
() -> new HttpServerOptions(config));
}
示例15: transform
import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
@Override
public VertxOptions transform(final JsonObject input) {
final JsonObject config = input.getJsonObject(NodeVisitor.YKEY_OPTIONS, null);
return Fn.getSemi(null == config, LOGGER,
VertxOptions::new,
() -> new VertxOptions(config));
}