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


Java LinkedTreeMap.get方法代码示例

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


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

示例1: getAttachmentList

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
private JsonArray getAttachmentList(LinkedTreeMap<String, Object> attachmentList, String docID) {
	JsonArray attachmentArray = new JsonArray();

	for (Object key : attachmentList.keySet()) {
		LinkedTreeMap<String, Object> attach = (LinkedTreeMap<String, Object>) attachmentList.get(key);

		JsonObject attachedObject = new JsonObject();
		// set the content type of the attachment
		attachedObject.addProperty("content_type", attach.get("content_type").toString());
		// append the document id and attachment key to the URL
		attachedObject.addProperty("url", "attach?id=" + docID + "&key=" + key);
		// set the key of the attachment
		attachedObject.addProperty("key", key + "");

		// add the attachment object to the array
		attachmentArray.add(attachedObject);
	}

	return attachmentArray;
}
 
开发者ID:IBM-Cloud,项目名称:java-cloudant,代码行数:21,代码来源:ResourceServlet.java

示例2: formatListForPopcorn

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
public ArrayList<Media> formatListForPopcorn(ArrayList<Media> existingList) {
    for (LinkedTreeMap<String, Object> item : showsList) {
        Media media;
        if (item.get("type").toString().equalsIgnoreCase("movie")) {
            media = new Movie(sMediaProvider, null);
        } else {
            media = new Show(sMediaProvider, null);
        }

        media.title = (String) item.get("name");
        media.videoId = item.get("id").toString();
        media.imdbId = "mal-" + media.videoId;
        String year = item.get("aired").toString();
        if (year.contains(", ")) {
            year = year.split(", ")[1];
        }
        if (year.contains(" ")) {
            year = year.split(" ")[0];
        }
        media.year = year;
        media.image = media.headerImage = item.get("malimg").toString();

        existingList.add(media);
    }
    return existingList;
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:27,代码来源:HaruProvider.java

示例3: formatListForPopcorn

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
public ArrayList<Media> formatListForPopcorn(ArrayList<Media> existingList) {
    for (LinkedTreeMap<String, Object> item : showsList) {
        Show show = new Show(sMediaProvider, sSubsProvider);

        show.title = (String) item.get("title");
        show.videoId = (String) item.get("imdb_id");
        show.seasons = (Integer) item.get("seasons");
        show.tvdbId = (String) item.get("tvdb_id");
        show.year = (String) item.get("year");
        LinkedTreeMap<String, String> images = (LinkedTreeMap<String, String>) item.get("images");
        if(!images.get("poster").contains("images/posterholder.png"))
            show.image = images.get("poster").replace("/original/", "/medium/");
        if(!images.get("poster").contains("images/posterholder.png"))
            show.headerImage = images.get("fanart").replace("/original/", "/medium/");

        existingList.add(show);
    }
    return existingList;
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:20,代码来源:EZTVProvider.java

示例4: requestRoomId

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
@SuppressWarnings(value = "unchecked")
private String requestRoomId() throws Exception {
  HttpResponse response =
      callUri("Rooms", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.OK);
  checkMediaType(response, HttpContentType.APPLICATION_JSON);

  String body = getBody(response);
  LinkedTreeMap<?, ?> map = getLinkedTreeMap(body);

  List<LinkedTreeMap<String, String>> results = (List) map.get("results");

  for (LinkedTreeMap<String, String> result : results) {
    if(result.get("Name").equals("Small green room")) {
      return result.get("Id");
    }
  }
  return null;
}
 
开发者ID:mibo,项目名称:janos,代码行数:19,代码来源:EntityJsonTest.java

示例5: entitySetRooms

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
@Test
@SuppressWarnings(value = "unchecked")
public void entitySetRooms() throws Exception {
  HttpResponse response =
      callUri("Rooms", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.OK);
  checkMediaType(response, HttpContentType.APPLICATION_JSON);

  String body = getBody(response);
  LinkedTreeMap<?, ?> map = getLinkedTreeMap(body);

  List<LinkedTreeMap<String, String>> results = (List) map.get("results");
  assertFalse(results.isEmpty());

  LinkedTreeMap<String, String> firstRoom = null;
  for (LinkedTreeMap<String, String> result: results) {
    if(result.get("Name").equals("Small green room")) {
      firstRoom = result;
    }
  }
  assertNotNull(firstRoom);
  assertEquals("Small green room", firstRoom.get("Name"));
  assertEquals(20.0, firstRoom.get("Seats"));
  assertEquals(42.0, firstRoom.get("Version"));
}
 
开发者ID:mibo,项目名称:janos,代码行数:25,代码来源:EntitySetJsonTest.java

示例6: entitySetRoomsSkip

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
@Test
@SuppressWarnings(value = "unchecked")
public void entitySetRoomsSkip() throws Exception {
  HttpResponse response =
      callUri("Rooms?$skip=1", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON, HttpStatusCodes.OK);
  checkMediaType(response, HttpContentType.APPLICATION_JSON);

  String body = getBody(response);
  LinkedTreeMap<?, ?> map = getLinkedTreeMap(body);

  List<LinkedTreeMap<String, String>> results = (List) map.get("results");
  assertFalse(results.isEmpty());
  //
  assertTrue(roomsCount() != results.size());

  LinkedTreeMap<String, String> roomToCheck = null;
  for (LinkedTreeMap<String, String> result: results) {
    if(result.get("Name").equals("Small dark green room")) {
      roomToCheck = result;
    }
  }
  assertNotNull(roomToCheck);
  assertEquals("Small dark green room", roomToCheck.get("Name"));
  assertEquals(30.0, roomToCheck.get("Seats"));
  assertEquals(2.0, roomToCheck.get("Version"));
}
 
开发者ID:mibo,项目名称:janos,代码行数:27,代码来源:EntitySetJsonTest.java

示例7: testToJsonBinaryProperty

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testToJsonBinaryProperty() throws Exception {
  FilterExpression expression = UriParser.parseFilter(null, null, "a eq b");
  String jsonString = toJson(expression);
  Gson gsonConverter = new Gson();

  LinkedTreeMap<String, Object> jsonMap = gsonConverter.fromJson(jsonString, LinkedTreeMap.class);
  checkBinary(jsonMap, "eq", null);

  LinkedTreeMap<String, Object> left = (LinkedTreeMap<String, Object>) jsonMap.get(LEFT);
  checkProperty(left, null, "a");

  LinkedTreeMap<String, Object> right = (LinkedTreeMap<String, Object>) jsonMap.get(RIGHT);
  checkProperty(right, null, "b");
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:FilterToJsonTest.java

示例8: createAnonymousUser

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
public static String createAnonymousUser(String android_ID) throws UnsupportedEncodingException
	{
		HttpPost request = new HttpPost("https://testservicecenter.yucat.com/servicecenter/api/user/anonymous");
//		URI uri = URI.create("https://testserviceCenter.yucat.com/ServiceCenter/api/user/anonymous");
//		HttpPost request = new HttpPost("https://testserviceCenter.yucat.com/ServiceCenter/api/account/permission");
		request.setHeader("Authorization", CLIENT);
		request.setHeader(HTTP.CONTENT_TYPE,"application/json");
		Gson gson = new Gson();
		String json = gson.toJson(new AnonymousUserCreateInput(android_ID));
		Log.i("ServiceCentre", "client = " + CLIENT);
		Log.i("ServiceCentre", "input json = " + json);
		request.setEntity(new StringEntity(json, "UTF-8"));
		String response = executeRequest(request, 3000, 3000);
		LinkedTreeMap<String, Double> map = gson.fromJson(response, LinkedTreeMap.class);
		if(map == null) return null;
		Double userid = map.get("anonymoususerid");
		Log.i("ServiceCentre", "parse user id = " + userid);
		Log.i("ServiceCentre", "user id to string = " + String.valueOf(userid.intValue()));
		return String.valueOf(userid.intValue());
	}
 
开发者ID:liarosge,项目名称:apps4thess,代码行数:21,代码来源:ServiceCentreUtils.java

示例9: createEntryRoomWithLink

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
@Test
public void createEntryRoomWithLink() throws Exception {
  String content = "{\"d\":{\"__metadata\":{\"id\":\"" + getEndpoint() + "Rooms('1')\","
      + "\"uri\":\"" + getEndpoint() + "Rooms('1')\",\"type\":\"RefScenario.Room\","
      + "\"etag\":\"W/\\\"3\\\"\"},"
      + "\"Id\":\"1\",\"Name\":\"Room 104\","
      + "\"nr_Employees\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Employees\"}},"
      + "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + getEndpoint() + "Rooms('1')/nr_Building\"}}}}";
  assertNotNull(content);
  HttpResponse response =
      postUri("Rooms", content, HttpContentType.APPLICATION_JSON, HttpHeaders.ACCEPT,
          HttpContentType.APPLICATION_JSON, HttpStatusCodes.CREATED);
  checkMediaType(response, HttpContentType.APPLICATION_JSON);

  String body = getBody(response);
  LinkedTreeMap<?, ?> map = getLinkedTreeMap(body);
  assertEquals("104", map.get("Id"));
  assertEquals("Room 104", map.get("Name"));
  @SuppressWarnings("unchecked")
  LinkedTreeMap<String, Object> employeesMap = (LinkedTreeMap<String, Object>) map.get("nr_Employees");
  assertNotNull(employeesMap);
  @SuppressWarnings("unchecked")
  LinkedTreeMap<String, String> deferredMap = (LinkedTreeMap<String, String>) employeesMap.get("__deferred");
  assertNotNull(deferredMap);
  assertEquals(getEndpoint() + "Rooms('104')/nr_Employees", deferredMap.get("uri"));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:EntryJsonCreateTest.java

示例10: parseArrayValue

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
@NonNull
public static ArrayValue parseArrayValue(LinkedTreeMap receivedStructure) {
    return new ArrayValue(
            (ArrayList) receivedStructure.get("array"),
            ((Double) receivedStructure.get("len")).intValue(),
            ((Double) receivedStructure.get("offset")).intValue()
    );
}
 
开发者ID:mateuszk87,项目名称:BadIntent,代码行数:9,代码来源:ParcelOperation.java

示例11: getToken

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
public static String getToken(String json) {
    Response result = new Gson().fromJson(json, Response.class);
    LinkedTreeMap content = (LinkedTreeMap) result.getData();
    for (Object key : content.keySet()) {
        System.out.println(key);
        if ("token.TokenTest".equals(key.toString())) {
            System.out.println("111");
            return (String) content.get(key);
        }
    }
    return null;
}
 
开发者ID:aollio,项目名称:school-express-delivery,代码行数:13,代码来源:SimpleTest.java

示例12: getTokenFromJson

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
public static String getTokenFromJson(String json) {
    Response result = new Gson().fromJson(json, Response.class);
    LinkedTreeMap content = (LinkedTreeMap) result.getData();
    for (Object key : content.keySet()) {
        if ("token".equals(key.toString())) {
            return (String) content.get(key);
        }
    }
    return null;
}
 
开发者ID:aollio,项目名称:school-express-delivery,代码行数:11,代码来源:TestUtil.java

示例13: getValueDate

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
public static  ZonedDateTime getValueDate(LinkedTreeMap value){
    try {
        String type = getPRType(value);
        LinkedTreeMap pr = (LinkedTreeMap) value.get(type);
        if(pr.containsKey("created_on")){
            return ZonedDateTime.parse(pr.get("created_on").toString());
        }else{
            return ZonedDateTime.parse(pr.get("date").toString());
        }

    }catch (Exception e){
        //Gotcha!
        return null;
    }
}
 
开发者ID:mgustavocoder,项目名称:hard-worker-activity-stream,代码行数:16,代码来源:PullRequestActivity.java

示例14: getCodeTemplateForTask

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
private static String getCodeTemplateForTask(@NotNull Language language,
                                             @Nullable LinkedTreeMap codeTemplates) {
  if (codeTemplates != null) {
    final String languageString = EduPluginConfigurator.INSTANCE.forLanguage(language).getStepikDefaultLanguage();
    return (String)codeTemplates.get(languageString);
  }

  return null;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:10,代码来源:EduAdaptiveStepicConnector.java

示例15: getZipFromLatLong

import com.google.gson.internal.LinkedTreeMap; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public static String getZipFromLatLong(String latitude, String longitude) {
       String request = "https://maps.googleapis.com/maps/api/geocode/json?";
       String address = "address=";
       String coOrdinates = "latlng=";
	CustomUtilities custom = new CustomUtilities();
	String zip = "";
	String finalRequest = request + coOrdinates + latitude + "," + longitude + "&" + key;

	// To convert resulting JSON into Map
	Gson gson = new Gson();

	// Models expected JSON, very basic
	Type type = new TypeToken<Map<String, Object>>() {
	}.getType();

	// Pulls JSON from api request
	String json = custom.RequestToString(finalRequest);

	// Creates map using Gson
	Map<String, Object> map = gson.fromJson(json, type);
	ArrayList list = ((ArrayList)((LinkedTreeMap)((ArrayList) map.get("results")).get(0)).get("address_components"));
	
	for (Object elt : list) {
		LinkedTreeMap treeElt = (LinkedTreeMap) elt;
		String name = (String) ((ArrayList)treeElt.get("types")).get(0);
		
		if (name.equals("postal_code")) {
			zip = (String) (treeElt.get("short_name"));
			break;
		}
	}
	
	return zip == null ? " " : zip;
}
 
开发者ID:faizan-ali,项目名称:full-javaee-app,代码行数:36,代码来源:Geocode.java


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