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


Java JsonObject.getLong方法代碼示例

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


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

示例1: init

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
/**
 * Read the configuration and set the initial values.
 * @param config the configuration
 */
void init(JsonObject config) {
  period = config.getLong("period", 3000L);
  variation = config.getInteger("variation", 100);
  name = config.getString("name");
  Objects.requireNonNull(name);
  symbol = config.getString("symbol", name);
  stocks = config.getInteger("volume", 10000);
  price = config.getDouble("price", 100.0);

  value = price;
  ask = price + random.nextInt(variation / 2);
  bid = price + random.nextInt(variation / 2);

  share = stocks / 2;

  System.out.println("Initialized " + name);
}
 
開發者ID:cescoffier,項目名稱:vertx-kubernetes-workshop,代碼行數:22,代碼來源:MarketDataVerticle.java

示例2: start

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
@Override
public void start(Future<Void> future) throws Exception {
    super.start();

    JsonObject config = config();
    heRssUrl = config.getString(CommonConstants.HE_RSS_URL);
    pollPeriod = config.getLong(CommonConstants.HE_RSS_URL_POLL_PERIOD);

    bootstrapRssFeed();

    future.complete();
}
 
開發者ID:benemon,項目名稱:he-rss-poll,代碼行數:13,代碼來源:PollingVerticle.java

示例3: fromJson

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
/**
   * get value from a {@code JsonObject}
   * 
   * @param json the {@code JsonObject}
   *
   * @return the {@code JsonObject}
   */
public AbstractFdfsOptions fromJson(JsonObject json) {

	this.charset = json.getString(CHARSET, DEFAULT_CHARSET);
	this.connectTimeout = json.getLong(CONNECT_TIMEOUT, DEFAULT_CONNECT_TIMEOUT);
	this.networkTimeout = json.getLong(NETWORK_TIMEOUT, DEFAULT_NETWORK_TIMEOUT);
	this.defaultExt = json.getString(DEFAULT_EXT, DEFAULT_DEFAULT_EXT);
	this.poolSize = json.getInteger(POOLSIZE, DEFAULT_POOLSIZE);

	return this;
}
 
開發者ID:gengteng,項目名稱:vertx-fastdfs-client,代碼行數:18,代碼來源:AbstractFdfsOptions.java

示例4: parseRequest

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
/**
 * Convert a request from Json to Java object
 *
 * @param jsonRequest {@link JsonObject} json formatted request
 * @return {@link Request}
 * @throws NullPointerException if jsonRequest is null
 */
private Request parseRequest(JsonObject jsonRequest) {
    Objects.requireNonNull(jsonRequest);
    Date start = new Date(jsonRequest.getLong("start"));
    Date end = new Date(jsonRequest.getLong("end"));
    String address = jsonRequest.getString("address");
    Geocoder geocoder = Geocoder.geocode(address);
    if (geocoder.getLatLong() == null) {
        LOGGER.warn("Can't geocode this address {}", address);
        return null;
    }
    return new Request(start, end, new BoundingBox(geocoder.getBbox()), Date.from(Instant.now()));
}
 
開發者ID:IKB4Stream,項目名稱:IKB4Stream,代碼行數:20,代碼來源:VertxServer.java

示例5: KafkaSink

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
public KafkaSink(Vertx vertx, JsonObject json) {
  stream = KafkaWriteStream.create(vertx.getDelegate(), toMap(json));
  topic = json.getString("topic");
  partition = json.getInteger("partition");
  timestamp = json.getLong("timestamp");
  key = requiredEventExpression(json.getString("key"));
  name = json.getString("name");
}
 
開發者ID:cescoffier,項目名稱:fluid,代碼行數:9,代碼來源:KafkaSink.java

示例6: EtcdData

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
private EtcdData(final Class<?> clazz) {
    this.clazz = clazz;
    this.logger = Annal.get(clazz);
    // Read configuration
    final JsonObject config = NODE.read();
    if (config.containsKey(KEY)) {
        final JsonObject root = config.getJsonObject(KEY);
        // Verify the data
        Fn.flingUp(() -> Fn.shuntZero(() -> Ruler.verify(KEY, root), root),
                LOGGER);
        if (root.containsKey(TIMEOUT)) {
            this.timeout = root.getLong(TIMEOUT);
        }
        if (root.containsKey(MICRO)) {
            this.application = root.getString(MICRO);
        }
        // Nodes
        if (root.containsKey(NODES)) {
            this.config.addAll(root.getJsonArray(NODES));
        }
        LOGGER.info(Info.ETCD_TIMEOUT,
                this.application, this.timeout, this.config.size());
    }
    Fn.flingUp(this.config.isEmpty(), this.logger,
            EtcdConfigEmptyException.class, this.clazz);

    final Set<URI> uris = new HashSet<>();
    final ConcurrentMap<Integer, String> networks
            = new ConcurrentHashMap<>();
    Observable.fromIterable(this.config)
            .filter(Objects::nonNull)
            .map(item -> (JsonObject) item)
            .filter(item -> item.containsKey(PORT) && item.containsKey(HOST))
            .map(item -> {
                final Integer port = item.getInteger(PORT);
                final String host = item.getString(HOST);
                networks.put(port, host);
                return "http://" + host + ":" + port;
            })
            .map(URI::create)
            .subscribe(uris::add);
    // Network checking
    networks.forEach((port, host) ->
            Fn.flingUp(!Net.isReach(host, port), LOGGER,
                    EtcdNetworkException.class, getClass(), host, port));
    LOGGER.info(Info.ETCD_NETWORK);
    this.client = new EtcdClient(uris.toArray(new URI[]{}));
}
 
開發者ID:silentbalanceyh,項目名稱:vertx-zero,代碼行數:49,代碼來源:EtcdData.java

示例7: addBasicRoute

import io.vertx.core.json.JsonObject; //導入方法依賴的package包/類
private void addBasicRoute(JsonObject conf) {
	router.route().handler(CookieHandler.create());

	BodyHandler bh = BodyHandler.create();
	bh.setMergeFormAttributes(false);
	bh.setUploadsDirectory(this.upload_dir);
	// bh.setDeleteUploadedFilesOnEnd(false);
	router.route().handler(bh);

	String hasSession = conf.getString("session","true");
	if("true".equals(hasSession)){		
		SessionStore sessionStore = null;
		if (vertx.isClustered())
			sessionStore = ClusteredSessionStore.create(vertx,SessionName);
		else
			sessionStore = LocalSessionStore.create(vertx,SessionName);		
		
		SessionHandler sessionHandler = SessionHandler.create(sessionStore);
		sessionHandler.setNagHttps(false).setCookieHttpOnlyFlag(true);
		Long sessionTimeount = conf.getLong("session.timeout");
		if(sessionTimeount!=null && sessionTimeount>0)
			sessionHandler.setSessionTimeout(sessionTimeount);
		
		router.route().handler(sessionHandler);

		if(gsetting.hasAuth()  && !this.appContain.isEmpty()){
			router.route().handler(UserSessionHandler.create(authMgr.authProvider));
			
			GateAuthHandler authHandler = new GateAuthHandler(authMgr);
			router.route().handler(authHandler::handle);
			
		}
	}
	
	router.route().failureHandler(rc->{
		
		HttpServerResponse response = rc.response();
		
		if(response.ended())
			return;
		
		int statusCode = rc.statusCode() == -1 ? 500 : rc.statusCode();

           log.error("Error,status code: {}. ",statusCode);
           response.setStatusCode(statusCode).end("status code:"+statusCode);
	});

}
 
開發者ID:troopson,項目名稱:etagate,代碼行數:49,代碼來源:OutServerVerticle.java


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