当前位置: 首页>>代码示例>>Java>>正文


Java JsonArray.getJsonObject方法代码示例

本文整理汇总了Java中io.vertx.core.json.JsonArray.getJsonObject方法的典型用法代码示例。如果您正苦于以下问题:Java JsonArray.getJsonObject方法的具体用法?Java JsonArray.getJsonObject怎么用?Java JsonArray.getJsonObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.core.json.JsonArray的用法示例。


在下文中一共展示了JsonArray.getJsonObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testInsertEpisodeView

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testInsertEpisodeView(TestContext ctx) throws Exception {
    JsonObject data = new JsonObject()
            .put("seriesId", 42009)
            .put("episodeId", 1188308)
            .put("seasonId", "52595fb3760ee346619586ed");
    database.insertEpisodeView("[email protected]", data.encode()).rxSetHandler()
            .doOnError(ctx::fail).toBlocking().value();
    JsonArray episodes = localDatabase.queryBlocking("SELECT * FROM Series WHERE Username = ?", new JsonArray()
            .add("[email protected]"));
    assertThat(episodes.size(), is(1));
    JsonObject episode = episodes.getJsonObject(0);
    assertThat(episode.getInteger("SeriesId"), is(data.getInteger("seriesId")));
    assertThat(episode.getInteger("EpisodeId"), is(data.getInteger("episodeId")));
    assertThat(episode.getString("SeasonId"), is(data.getString("seasonId")));
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:17,代码来源:DatabaseServiceTest.java

示例2: testInsertMovieView

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testInsertMovieView(TestContext ctx) throws Exception {
    JsonObject data = new JsonObject()
            .put("movieId", "49051")
            .put("start", "24 March, 2017 22:01")
            .put("end", "24 March, 2017 23:31")
            .put("wasFirst", false)
            .put("wasCinema", true)
            .put("comment", "something random");
    database.insertView("[email protected]", data.encode()).rxSetHandler()
            .doOnError(ctx::fail).toBlocking().value();
    JsonArray views = localDatabase.queryBlocking("SELECT * FROM Views", null);
    assertThat(views.size(), is(1));
    JsonObject view = views.getJsonObject(0);
    assertThat(String.valueOf(view.getInteger("MovieId")), is(data.getString("movieId")));
    assertThat(view.getString("Start"), is("2017-03-24T20:01:00Z"));
    assertThat(view.getString("End"), is("2017-03-24T21:31:00Z"));
    assertThat(view.getInteger("WasFirst"), is(data.getBoolean("wasFirst") ? 1 : 0));
    assertThat(view.getInteger("WasCinema"), is(data.getBoolean("wasCinema") ? 1 : 0));
    assertThat(view.getString("Comment"), is(data.getString("comment")));
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:22,代码来源:DatabaseServiceTest.java

示例3: testGetTopMoviesHome

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testGetTopMoviesHome(TestContext ctx) throws Exception {
    Map<Integer, JsonObject> data = CommonUtils.<Integer, JsonObject>mapBuilder()
            .put(49051, new JsonObject().put("Title", "The Hobbit: An Unexpected Journey").put("Count", 1))
            .put(315837, new JsonObject().put("Title", "Ghost in the Shell").put("Count", 1))
            .build();
    localDatabase.updateOrInsertBlocking(SQL_INSERT_MOVIES_HOBBIT, null);
    localDatabase.updateOrInsertBlocking(SQL_INSERT_MOVIES_GHOST, null);
    localDatabase.updateOrInsertBlocking(SQL_INSERT_VIEW_HOBBIT, null);
    localDatabase.updateOrInsertBlocking(SQL_INSERT_VIEW_GHOST, null);
    JsonArray array = database.getTopMoviesHome("[email protected]").rxSetHandler()
            .doOnError(ctx::fail)
            .map(DatabaseService::getRows)
            .toBlocking().value();
    assertThat(array.size(), is(2));
    JsonObject movie1 = array.getJsonObject(0);
    JsonObject movie1data = data.get(movie1.getInteger("MovieId"));
    assertThat(movie1.getString("Title"), is(movie1data.getString("Title")));
    assertThat(movie1.getInteger("Count"), is(movie1data.getInteger("Count")));
    JsonObject movie2 = array.getJsonObject(1);
    JsonObject movie2data = data.get(movie2.getInteger("MovieId"));
    assertThat(movie2.getString("Title"), is(movie2data.getString("Title")));
    assertThat(movie2.getInteger("Count"), is(movie2data.getInteger("Count")));
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:25,代码来源:DatabaseServiceTest.java

示例4: deployAll

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
/**
 * Deploys the list of local and/or remote components
 *
 * @param future Vert.x Future object to update the status of deployment
 * @see <a href="http://vertx.io/docs/apidocs/io/vertx/core/Future.html" target="_blank">Future</a>
 */
public void deployAll(Future<Void> future) {
	if (null == this.vertx) {
		String errMesg = "Not setup yet! Call 'setup' method first.";

		logger.error(errMesg);
		future.fail(new Exception(errMesg));

		return;
	}

	JsonArray compList = this.deployConfig.getJsonArray("components");
	List<DeployComponent> components = new ArrayList<>();
	int listLen = compList.size();
	JsonObject deployConf;

	for (int idx = 0; idx < listLen; idx++) {
		deployConf = compList.getJsonObject(idx);
		components.add(this.setupComponent(deployConf));
	}

	this.deployRecords.deployAll(components, future);
}
 
开发者ID:mustertech,项目名称:rms-deployer,代码行数:29,代码来源:VtxDeployer.java

示例5: subscriptionResult

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
private void subscriptionResult(final AsyncResult<HttpResponse<JsonArray>> ar) {
	if (ar.succeeded()) {
		// Process the result
		this.captureCookies(ar.result().cookies());
		final JsonArray receivedData = ar.result().body();
		final JsonObject status = receivedData.getJsonObject(receivedData.size() - 1);
		if (status.getBoolean("successful", false)) {
			// If the array has only one member we didn't get new data
			if (receivedData.size() > 1) {
				this.processReceivedData(receivedData);
			}
			// Do it again eventually
			if (!this.shuttingDown && !this.shutdownCompleted) {
				this.subscriptionFetch();
			} else {
				this.shutdownCompleted = true;
			}
		} else {
			// We won't continue
			this.logger.fatal(status.encodePrettily());
			this.shutdownCompleted = true;
		}

	} else {
		// Preliminary stopping here
		// needs to be handled
		this.logger.fatal(ar.cause());
		this.shutdownCompleted = true;
	}
}
 
开发者ID:Stwissel,项目名称:vertx-sfdc-platformevents,代码行数:31,代码来源:CometD.java

示例6: testGetSeenEpisodes

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testGetSeenEpisodes(TestContext ctx) throws Exception {
    localDatabase.updateOrInsertBlocking(SQL_INSERT_SERIES_INFO, null);
    localDatabase.updateOrInsertBlocking(SQL_INSERT_SERIES_EPISODE, null);
    JsonArray episodes = database.getSeenEpisodes("[email protected]", 42009).rxSetHandler()
            .doOnError(ctx::fail)
            .map(DatabaseService::getRows)
            .toBlocking()
            .value();
    assertThat(episodes.size(), is(1));
    JsonObject episode = episodes.getJsonObject(0);
    assertThat(episode.getInteger(EPISODEID.getName()), is(1188308));
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:14,代码来源:DatabaseServiceTest.java

示例7: testInsertSeries

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testInsertSeries(TestContext ctx) throws Exception {
    JsonObject data = new JsonObject()
            .put("Id", 42009)
            .put("Title", "Black Mirror")
            .put("Image", "/djUxgzSIdfS5vNP2EHIBDIz9I8A.jpg");
    database.insertSeries(data.getInteger("Id"), data.getString("Title"), data.getString("Image"))
            .rxSetHandler().doOnError(ctx::fail).toBlocking().value();
    JsonArray series = localDatabase.queryBlocking("SELECT * FROM SeriesInfo", null);
    assertThat(series.size(), is(1));
    JsonObject show = series.getJsonObject(0);
    assertThat(data, equalTo(show));
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:14,代码来源:DatabaseServiceTest.java

示例8: testInsertMovie

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testInsertMovie(TestContext ctx) throws Exception {
    JsonObject data = new JsonObject()
            .put("Id", 49051)
            .put("Title", "The Hobbit: An Unexpected Journey")
            .put("Year", 2012)
            .put("Image", "/w29Guo6FX6fxzH86f8iAbEhQEFC.jpg");
    database.insertMovie(data.getInteger("Id"), data.getString("Title"), data.getInteger("Year"),
            data.getString("Image")).rxSetHandler().doOnError(ctx::fail).toBlocking().value();
    JsonArray movies = localDatabase.queryBlocking("SELECT * FROM Movies", null);
    assertThat(movies.size(), is(1));
    JsonObject movie = movies.getJsonObject(0);
    assertThat(data, equalTo(movie));
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:15,代码来源:DatabaseServiceTest.java

示例9: testInsertFbGoogleIdUser

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testInsertFbGoogleIdUser() throws Exception {
    database.insertUser("[email protected]", "ultrateam3000", "ultra", "tester")
            .rxSetHandler().toBlocking().value();
    JsonArray users = localDatabase.queryBlocking("SELECT * FROM Users", null);
    assertThat(users.size(), is(3));
    JsonObject user = users.getJsonObject(2);
    assertThat(user.getString("Firstname"), is("ultra"));
    assertThat(user.getString("Lastname"), is("tester"));
    assertThat(user.getString("Username"), is("[email protected]"));
    assertThat(user.getString("Password"), is(hash("ultrateam3000", user.getString("Salt"))));
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:13,代码来源:DatabaseServiceTest.java

示例10: getSingleItem

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
private JsonObject getSingleItem(TestContext ctx, Future<JsonObject> future) {
    JsonArray array = future.rxSetHandler()
            .doOnError(ctx::fail)
            .map(DatabaseService::getRows)
            .toBlocking().value();
    assertThat(array.size(), is(1));
    return array.getJsonObject(0);
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:9,代码来源:DatabaseServiceTest.java

示例11: testGetWatchingSeries

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testGetWatchingSeries(TestContext ctx) throws Exception {
    localDatabase.updateOrInsertBlocking(SQL_INSERT_SERIES_INFO, null);
    localDatabase.updateOrInsertBlocking(SQL_INSERT_SERIES_EPISODE, null);
    JsonArray series = database.getWatchingSeries("[email protected]").rxSetHandler()
            .doOnError(ctx::fail)
            .map(DatabaseService::getRows)
            .toBlocking().value();
    assertThat(series.size(), is(1));
    JsonObject show = series.getJsonObject(0);
    assertThat(show.getString("Title"), is("Black Mirror"));
    assertThat(show.getString("Image"), is("/djUxgzSIdfS5vNP2EHIBDIz9I8A.jpg"));
    assertThat(show.getInteger("SeriesId"), is(42009));
    assertThat(show.getInteger("Count"), is(1));
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:16,代码来源:DatabaseServiceTest.java

示例12: read

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
/**
 * Single query
 *
 * @param dataObject
 * @param refKey
 * @param verticalKey
 * @param mountField
 * @return
 */
public JsonObject read(final JsonObject dataObject,
                       final String refKey,
                       final String verticalKey,
                       final String mountField,
                       final boolean unique) {
    final JsonArray dataArray = new JsonArray().add(dataObject);
    this.read(dataArray, refKey, verticalKey, mountField, unique);
    return dataArray.getJsonObject(Values.IDX);
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:19,代码来源:MongoRtor.java

示例13: mapIndex

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
private static ConcurrentMap<Integer, Object> mapIndex(
        final JsonArray sources,
        final String field
) {
    final ConcurrentMap<Integer, Object> resultMap =
            new ConcurrentHashMap<>();
    for (int idx = Values.IDX; idx < sources.size(); idx++) {
        final JsonObject item = sources.getJsonObject(idx);
        final Object value = item.getValue(field);
        if (null != value) {
            resultMap.put(idx, value);
        }
    }
    return resultMap;
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:16,代码来源:Dual.java

示例14: syncBatchMaterial

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
/**
 * 获取素材
 * @param mediaType 素材类型
 * @param offset 开始位置
 * @param count 获取数量
 * @return
 */
public static Material syncBatchMaterial(MediaType mediaType, Integer offset, Integer count, Account mpAccount){
	String accessToken = getAccessToken(mpAccount);
	String url = WxApi.getBatchMaterialUrl(accessToken);
	JsonObject bodyObj = new JsonObject();
	bodyObj.put("type", mediaType.toString());
	bodyObj.put("offset", offset);
	bodyObj.put("count", count);
	String body = bodyObj.toString();
	try {
		JsonObject jsonObj = WxApi.httpsRequest(url, "POST", body);
		if (jsonObj.containsKey("errcode")) {//获取素材失败
			System.out.println(ErrCode.errMsg(jsonObj.getInteger("errcode")));
			return null;
		}else{
			Material material = new Material();
			material.setTotalCount(jsonObj.getInteger("total_count"));
			material.setItemCount(jsonObj.getInteger("item_count"));
			JsonArray arr = jsonObj.getJsonArray("item");
			if(arr != null && arr.size() > 0){
				List<MaterialItem> itemList = new ArrayList<MaterialItem>();
				for(int i = 0; i < arr.size(); i++){
					JsonObject item = arr.getJsonObject(i);
					MaterialItem materialItem = new MaterialItem();
					materialItem.setMediaId(item.getString("media_id"));
					materialItem.setUpdateTime(item.getLong("update_time")*1000L);
					if(item.containsKey("content")){//mediaType=news (图文消息)
						JsonArray articles = item.getJsonObject("content").getJsonArray("news_item");
						List<MaterialArticle> newsItems = new ArrayList<MaterialArticle>();
						for(int j = 0; j < articles.size(); j++){
							JsonObject article = articles.getJsonObject(j);
							MaterialArticle ma = new MaterialArticle();
							ma.setTitle(article.getString("title"));
							ma.setThumb_media_id(article.getString("thumb_media_id"));
							ma.setShow_cover_pic(article.getString("show_cover_pic"));
							ma.setAuthor(article.getString("author"));
							ma.setContent_source_url(article.getString("content_source_url"));
							ma.setContent(article.getString("content"));
							ma.setUrl(article.getString("url"));
							newsItems.add(ma);
						}
						materialItem.setNewsItems(newsItems);
					}else{
						materialItem.setName(item.getString("name"));
						materialItem.setUrl(item.getString("url"));
					}
					itemList.add(materialItem);
				}
				material.setItems(itemList);
			}
			return material;
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:Leibnizhu,项目名称:AlipayWechatPlatform,代码行数:64,代码来源:WxApiClient.java

示例15: insertOrder

import io.vertx.core.json.JsonArray; //导入方法依赖的package包/类
private void insertOrder(Handler replyMsg, JsonArray params) {
    JsonObject orderInsert = params.getJsonObject(0);
    orderDao.insert(orderInsert, replyMsg);
}
 
开发者ID:Leibnizhu,项目名称:AlipayWechatPlatform,代码行数:5,代码来源:OrderDBVerticle.java


注:本文中的io.vertx.core.json.JsonArray.getJsonObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。