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


Java JsonNode.getFields方法代码示例

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


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

示例1: addChild

import argo.jdom.JsonNode; //导入方法依赖的package包/类
/**
 * Add a child to the current json node
 * @param original the original json node where the new child will be added
 * @param key the key of the child that will be added
 * @param value json node value of the added child
 * @return the json node with the added child, or null if operation failed
 */
public static JsonNode addChild(JsonNode original, String key, JsonNode value) {
	Map<JsonStringNode, JsonNode> existingFields = original.getFields();
	Map<JsonStringNode, JsonNode> newMap = new HashMap<>();
	for (Entry<JsonStringNode, JsonNode> entry : existingFields.entrySet()) {
		newMap.put(entry.getKey(), entry.getValue());
	}

	newMap.put(JsonNodeFactories.string(key), value);
	return JsonNodeFactories.object(newMap);
}
 
开发者ID:repeats,项目名称:Repeat,代码行数:18,代码来源:JSONUtility.java

示例2: removeChild

import argo.jdom.JsonNode; //导入方法依赖的package包/类
/**
 * Remove a child (or children) from the current json node given the key to remove
 * @param original the original json node where the new child will be removed
 * @param key the key of the child that will be removed
 * @return the json node with the removed child, or null if operation failed
 */
public static JsonNode removeChild(JsonNode original, String key) {
	Map<JsonStringNode, JsonNode> existingFields = original.getFields();
	Map<JsonStringNode, JsonNode> newMap = new HashMap<>();
	for (Entry<JsonStringNode, JsonNode> entry : existingFields.entrySet()) {
		if (!entry.getKey().toString().equals(key)) {
			newMap.put(entry.getKey(), entry.getValue());
		}
	}

	return JsonNodeFactories.object(newMap);
}
 
开发者ID:repeats,项目名称:Repeat,代码行数:18,代码来源:JSONUtility.java

示例3: func_77453_b

import argo.jdom.JsonNode; //导入方法依赖的package包/类
public static Map func_77453_b(String p_77453_0_) {
   HashMap var1 = new HashMap();

   try {
      String var2 = "local";
      StringBuilder var3 = new StringBuilder();
      JsonRootNode var4 = (new JdomParser()).parse(p_77453_0_);
      List var5 = var4.getArrayNode(new Object[]{"stats-change"});
      Iterator var6 = var5.iterator();

      while(var6.hasNext()) {
         JsonNode var7 = (JsonNode)var6.next();
         Map var8 = var7.getFields();
         Entry var9 = (Entry)var8.entrySet().iterator().next();
         int var10 = Integer.parseInt(((JsonStringNode)var9.getKey()).getText());
         int var11 = Integer.parseInt(((JsonNode)var9.getValue()).getText());
         boolean var12 = true;
         StatBase var13 = StatList.func_75923_a(var10);
         if(var13 == null) {
            var12 = false;
            var13 = (new StatPlaceholder(var10)).func_75971_g();
         }

         var3.append(StatList.func_75923_a(var10).field_75973_g).append(",");
         var3.append(var11).append(",");
         if(var12) {
            var1.put(var13, Integer.valueOf(var11));
         }
      }

      MD5String var15 = new MD5String(var2);
      String var16 = var15.func_75899_a(var3.toString());
      if(!var16.equals(var4.getStringValue(new Object[]{"checksum"}))) {
         System.out.println("CHECKSUM MISMATCH");
         return null;
      }
   } catch (InvalidSyntaxException var14) {
      var14.printStackTrace();
   }

   return var1;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:43,代码来源:StatFileWriter.java

示例4: func_77453_b

import argo.jdom.JsonNode; //导入方法依赖的package包/类
public static Map func_77453_b(String par0Str)
{
    HashMap hashmap = new HashMap();

    try
    {
        String s1 = "local";
        StringBuilder stringbuilder = new StringBuilder();
        JsonRootNode jsonrootnode = (new JdomParser()).parse(par0Str);
        List list = jsonrootnode.getArrayNode(new Object[] {"stats-change"});
        Iterator iterator = list.iterator();

        while (iterator.hasNext())
        {
            JsonNode jsonnode = (JsonNode)iterator.next();
            Map map = jsonnode.getFields();
            Entry entry = (Entry)map.entrySet().iterator().next();
            int i = Integer.parseInt(((JsonStringNode)entry.getKey()).getText());
            int j = Integer.parseInt(((JsonNode)entry.getValue()).getText());
            boolean flag = true;
            StatBase statbase = StatList.getOneShotStat(i);

            if (statbase == null)
            {
                flag = false;
                statbase = (new StatPlaceholder(i)).registerStat();
            }

            stringbuilder.append(StatList.getOneShotStat(i).statGuid).append(",");
            stringbuilder.append(j).append(",");

            if (flag)
            {
                hashmap.put(statbase, Integer.valueOf(j));
            }
        }

        MD5String md5string = new MD5String(s1);
        String s2 = md5string.getMD5String(stringbuilder.toString());

        if (!s2.equals(jsonrootnode.getStringValue(new Object[] {"checksum"})))
        {
            System.out.println("CHECKSUM MISMATCH");
            return null;
        }
    }
    catch (InvalidSyntaxException invalidsyntaxexception)
    {
        invalidsyntaxexception.printStackTrace();
    }

    return hashmap;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:54,代码来源:StatFileWriter.java


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