當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonObject.forEach方法代碼示例

本文整理匯總了Java中io.vertx.core.json.JsonObject.forEach方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonObject.forEach方法的具體用法?Java JsonObject.forEach怎麽用?Java JsonObject.forEach使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.vertx.core.json.JsonObject的用法示例。


在下文中一共展示了JsonObject.forEach方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: packMetaData

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
/**
 * 封裝metadata為Buffer。
 * 
 * @param meta meta
 * @param charset charset
 * @return Buffer
 */
public static Buffer packMetaData(JsonObject meta, String charset) {
	StringBuilder builder = new StringBuilder();

	meta.forEach(pair -> {
		builder.append(pair.getKey());
		builder.append(FDFS_FIELD_SEPERATOR);
		builder.append(pair.getValue());
		builder.append(FDFS_RECORD_SEPERATOR);
	});

	if (builder.length() > 0) {
		builder.deleteCharAt(builder.length() - 1);
	}

	return Buffer.buffer(builder.toString(), charset);
}
 
開發者ID:gengteng,項目名稱:vertx-fastdfs-client,代碼行數:24,代碼來源:FdfsProtocol.java

示例2: apply

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
public Mirror apply(final Function<String, String> function) {
    final JsonObject result = this.data.copy();
    result.forEach((entry) ->
            this.converted.put(function.apply(entry.getKey()),
                    entry.getValue()));
    return this;
}
 
開發者ID:silentbalanceyh,項目名稱:vertx-zero,代碼行數:8,代碼來源:Mirror.java

示例3: get

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
public void get(String uri, JsonObject param, Handler<AsyncResult<HttpResponse<Buffer>>> h) {

		HttpRequest<Buffer> req = app.webclient.get(this.port,this.host, uri)
				.timeout(app.timeout);
		if(param!=null){
			param.forEach(entry -> {
				req.addQueryParam(entry.getKey(), "" + entry.getValue());
			});
		}		
		
		Handler<AsyncResult<HttpResponse<Buffer>>> callback =res->{
			if(res.succeeded()){				
				continueFailTimes=0;		
				log.info("{}, {} http://{}:{}{}",app.name,HttpMethod.GET,this.host,this.port,uri);			
				h.handle(Future.succeededFuture(res.result()));			
			}else{
				Throwable t = res.cause();
				this.onException(t, uri);
				h.handle(Future.failedFuture(t));				
			}		
		};
		
//		taskInProcessing=taskInProcessing+1;
		if(this.breaker!=null){
			breaker.<HttpResponse<Buffer>>execute(f->{
				req.send(f);
			}).setHandler(callback);	
		}else{			
			req.send(callback);
		}
				
	}
 
開發者ID:troopson,項目名稱:etagate,代碼行數:33,代碼來源:Node.java

示例4: start

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
/**
 * Entry point method which starts the server event loop and initializes
 * our current OMERO.web session store.
 */
@Override
public void start(Future<Void> future) {
    log.info("Starting verticle");

    if (config().getBoolean("debug")) {
        Logger root = (Logger) LoggerFactory.getLogger(
                "com.glencoesoftware.omero.ms");
        root.setLevel(Level.DEBUG);
    }

    // Set OMERO.server configuration options using system properties
    JsonObject omeroServer = config().getJsonObject("omero.server");
    omeroServer.forEach(entry -> {
        System.setProperty(entry.getKey(), (String) entry.getValue());
    });

    context = new ClassPathXmlApplicationContext(
            "classpath:ome/config.xml",
            "classpath:ome/services/datalayer.xml",
            "classpath*:beanRefContext.xml");

    // Deploy our dependency verticles
    JsonObject omero = config().getJsonObject("omero");
    vertx.deployVerticle(new PixelBufferVerticle(
            omero.getString("host"), omero.getInteger("port"), context),
            new DeploymentOptions().setWorker(
                    true).setMultiThreaded(true));

    HttpServer server = vertx.createHttpServer();
    Router router = Router.router(vertx);

    // Cookie handler so we can pick up the OMERO.web session
    router.route().handler(CookieHandler.create());

    // OMERO session handler which picks up the session key from the
    // OMERO.web session and joins it.
    JsonObject redis = config().getJsonObject("redis");
    sessionStore = new OmeroWebRedisSessionStore(redis.getString("uri"));
    router.route().handler(
            new OmeroWebSessionRequestHandler(sessionStore));

    // Pixel buffer request handlers
    router.get(
            "/tile/:imageId/:z/:c/:t")
        .handler(this::getTile);

    int port = config().getInteger("port");
    log.info("Starting HTTP server *:{}", port);
    server.requestHandler(router::accept).listen(port, result -> {
        if (result.succeeded()) {
            future.complete();
        } else {
            future.fail(result.cause());
        }
    });
}
 
開發者ID:glencoesoftware,項目名稱:omero-ms-pixel-buffer,代碼行數:61,代碼來源:PixelBufferMicroserviceVerticle.java

示例5: toMap

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
private static Map<String, Object> toMap(JsonObject json) {
  Map<String, Object> map = new LinkedHashMap<>();
  json.forEach(entry -> map.put(entry.getKey(), entry.getValue().toString()));
  return map;
}
 
開發者ID:cescoffier,項目名稱:fluid,代碼行數:6,代碼來源:KafkaSink.java

示例6: toMap

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
private static Map<String, String> toMap(JsonObject json) {
  Map<String, String> map = new LinkedHashMap<>();
  json.forEach(entry -> map.put(entry.getKey(), entry.getValue().toString()));
  return map;
}
 
開發者ID:cescoffier,項目名稱:fluid,代碼行數:6,代碼來源:KafkaSource.java


注:本文中的io.vertx.core.json.JsonObject.forEach方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。