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


Java Member类代码示例

本文整理汇总了Java中com.eclipsesource.json.JsonObject.Member的典型用法代码示例。如果您正苦于以下问题:Java Member类的具体用法?Java Member怎么用?Java Member使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addBlockMining

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
private static void addBlockMining(JsonArray prop, JBlock block) {
	if (prop != null) {
		JsonObject object = prop.asObject();
		for (JsonObject.Member member : object) {
			switch (member.getName()) {
			case "speed":
				block.setMiningTime(member.getValue().asFloat());
				break;
			case "tool":
				block.setMiningTool(ItemJson.toolType(member.getValue().asString()));
				break;
			case "toolLevel":
				block.setMiningToolLevel(member.getValue().asInt());
				break;
			case "other":
				block.setMiningOther(member.getValue().asBoolean());
				break;
			default:
				throw new JsonException("Unexpected item tool member \"" + member.getName() + "\"");
			}
		}
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:24,代码来源:BlockJson.java

示例2: parseSwitch

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
private void parseSwitch(JsonObject.Member member, String[] textures, String value) {
	parseSwitch2(member, textures, value);
	switch (member.getName()) {
	case "posZ":
		textures[BlockFace.posZ.index] = value;
		break;
	case "negZ":
		textures[BlockFace.negZ.index] = value;
		break;
	case "side":
		textures[BlockFace.posX.index] = value;
		textures[BlockFace.negX.index] = value;
		textures[BlockFace.posZ.index] = value;
		textures[BlockFace.negZ.index] = value;
		break;
	case "other":
		parseSwitchFor(textures, value);
		break;
	default:
		throw new JsonException("Unexpected block texture member \"" + member.getName() + "\"");
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:23,代码来源:BlockJson.java

示例3: parseSwitch2

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
private static void parseSwitch2(JsonObject.Member member, String[] textures, String value) {
	switch (member.getName()) {
	case "posX":
		textures[BlockFace.posX.index] = value;
		break;
	case "negX":
		textures[BlockFace.negX.index] = value;
		break;
	case "posY":
		break;
	case "top":
		textures[BlockFace.posY.index] = value;
		break;
	case "negY":
		break;
	case "bottom":
		textures[BlockFace.negY.index] = value;
		break;
	default:
		break;
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:23,代码来源:BlockJson.java

示例4: read

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
public static boolean read() {
	FileHandle fileHandle = Compatibility.get().getBaseFolder().child("settings.json");

	try {
		Reader reader = fileHandle.reader();
		JsonObject json = Json.parse(reader).asObject();
		reader.close();

		for (Member member : json) {
			Setting setting = set.settings.get(member.getName());
			setting.readJson(member.getValue());
		}

		return true;
	} catch (Exception e) {
		Log.error("Failed to read settings", e);
		fileHandle.delete();
		return false;
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:21,代码来源:Settings.java

示例5: iterator

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
/**
 * Returns an iterator over the members of this object in document order. The returned iterator
 * cannot be used to modify this object.
 *
 * @return an iterator over the members of this object
 */
public Iterator<Member> iterator() {
  final Iterator<String> namesIterator = names.iterator();
  final Iterator<JsonValue> valuesIterator = values.iterator();
  return new Iterator<JsonObject.Member>() {

    public boolean hasNext() {
      return namesIterator.hasNext();
    }

    public Member next() {
      String name = namesIterator.next();
      JsonValue value = valuesIterator.next();
      return new Member(name, value);
    }

    public void remove() {
      throw new UnsupportedOperationException();
    }

  };
}
 
开发者ID:ZencashOfficial,项目名称:zencash-swing-wallet-ui,代码行数:28,代码来源:JsonObject.java

示例6: read

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
public static boolean read() {
  FileHandle fileHandle = Compatibility.get().getBaseFolder().child("settings.json");
  
  try {
    Reader reader = fileHandle.reader();
    JsonObject json = Json.parse(reader).asObject();
    reader.close();

    for (Member member : json) {
      Setting setting = settings.get(member.getName());
      setting.readJson(member.getValue());
    }
    
    return true;
  } catch (Exception e) {
    Log.error("Failed to read settings", e);
    fileHandle.delete();
    return false;
  }
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:21,代码来源:Settings.java

示例7: iterator

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
/**
 * Returns an iterator over the members of this object in document order. The returned iterator
 * cannot be used to modify this object.
 *
 * @return an iterator over the members of this object
 */
@Override
public Iterator<Member> iterator() {
  final Iterator<String> namesIterator = names.iterator();
  final Iterator<JsonValue> valuesIterator = values.iterator();
  return new Iterator<JsonObject.Member>() {

    @Override
    public boolean hasNext() {
      return namesIterator.hasNext();
    }

    @Override
    public Member next() {
      String name = namesIterator.next();
      JsonValue value = valuesIterator.next();
      return new Member( name, value );
    }

    @Override
    public void remove() {
      throw new UnsupportedOperationException();
    }

  };
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:32,代码来源:JsonObject.java

示例8: iterator

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
/**
 * Returns an iterator over the members of this object in document order. The returned iterator
 * cannot be used to modify this object.
 *
 * @return an iterator over the members of this object
 */
public Iterator<Member> iterator() {
  final Iterator<String> namesIterator = names.iterator();
  final Iterator<JsonValue> valuesIterator = values.iterator();
  return new Iterator<JsonObject.Member>() {

    public boolean hasNext() {
      return namesIterator.hasNext();
    }

    public Member next() {
      String name = namesIterator.next();
      JsonValue value = valuesIterator.next();
      return new Member( name, value );
    }

    public void remove() {
      throw new UnsupportedOperationException();
    }

  };
}
 
开发者ID:cjdaly,项目名称:fold,代码行数:28,代码来源:JsonObject.java

示例9: iterator

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
/**
 * Returns an iterator over the members of this object in document order.
 * The returned iterator cannot be used to modify this object.
 *
 * @return an iterator over the members of this object
 */
public Iterator<Member> iterator() {
	final Iterator<String> namesIterator = names.iterator();
	final Iterator<JsonValue> valuesIterator = values.iterator();
	return new Iterator<JsonObject.Member>() {

		public boolean hasNext() {
			return namesIterator.hasNext();
		}

		public Member next() {
			String name = namesIterator.next();
			JsonValue value = valuesIterator.next();
			return new Member(name, value);
		}

		public void remove() {
			throw new UnsupportedOperationException();
		}

	};
}
 
开发者ID:MercadoBitcoin,项目名称:mb-api-client-java,代码行数:28,代码来源:JsonObject.java

示例10: flattenAsMap

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
/**
 * Returns a flattened JSON as Map.
 * 
 * @return a flattened JSON as Map
 */
public Map<String, Object> flattenAsMap() {
  if (flattenedMap != null) return flattenedMap;

  flattenedMap = newJsonifyLinkedHashMap();
  reduce(source);

  while (!elementIters.isEmpty()) {
    IndexedPeekIterator<?> deepestIter = elementIters.getLast();
    if (!deepestIter.hasNext()) {
      elementIters.removeLast();
    } else if (deepestIter.peek() instanceof Member) {
      Member mem = (Member) deepestIter.next();
      reduce(mem.getValue());
    } else { // JsonValue
      JsonValue val = (JsonValue) deepestIter.next();
      reduce(val);
    }
  }

  return flattenedMap;
}
 
开发者ID:wnameless,项目名称:json-flattener,代码行数:27,代码来源:JsonFlattener.java

示例11: fetchDeviceNamesFromNameTable

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
static private void fetchDeviceNamesFromNameTable(String filename)
{
	lastFetch=System.currentTimeMillis();
	try(FileReader f=new FileReader(filename))
	{
		JsonObject table=Json.parse(f).asObject();
		int cnt=0;
		synchronized(nameCache)
		{
			for(Member m:table)
			{
				nameCache.put(m.getName(),m.getValue().asString());
				cnt++;
			}
		}
		L.log(Level.INFO,"Read "+cnt+" entries from name table "+filename);
		couldFetchOnce=true;
		DeviceInfo.resolveNames();
	}
	catch(Exception e)
	{
		L.log(Level.WARNING, "Error reading device name table "+filename,e);
	}
}
 
开发者ID:owagner,项目名称:hm2mqtt,代码行数:25,代码来源:ReGaDeviceNameResolver.java

示例12: addBlockSwitch

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
private static void addBlockSwitch(JsonObject.Member member) {
	addBlockSwitch2(member);
	switch (member.getName()) {
	case "displayMeta":
		break;
	case "mining":
		break;
	case "drops":
		break;
	case "transparent":
		break;
	default:
		throw new JsonException("Unexpected block member \"" + member.getName() + "\"");
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:16,代码来源:BlockJson.java

示例13: addBlockSwitch2

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
private void addBlockSwitch2(JSonObject.Member member) {
	switch (member.getName()) {
	case "id":
		break;
	case "meta":
		break;
	case "texture":
		break;
	case "lightLevel":
		break;
	default:
		break;
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:15,代码来源:BlockJson.java

示例14: addBlock

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
public static void addBlock(JsonObject jsB) {
	String id = jsB.getString("id", null);
	if (id == null)
		throw new JsonException("No block id");
	int meta = jsB.getInt("meta", 1);
	JBlock block = new JBlock(id, meta);

	block.textures = parseMetaElement(jsB, "texture", new String[meta][], textureParser);
	block.lightLevel = parseMetaElement(jsB, "lightLevel", new Integer[meta], integerParser);
	block.transparent = parseMetaElement(jsB, "transparent", new Boolean[meta], booleanParser);
	block.drops = parseMetaElement(jsB, "drops", new ItemStackPlaceholder[meta][], itemStackArrayParser);

	JsonValue prop;

	prop = jsB.get("displayMeta");
	addBlockDisplay(prop, block, meta);

	prop = jsB.get("mining");
	addBlockMining(prop, block);

	for (JsonObject.Member member : jsB) {
		addBlockSwitch(member);
	}

	block.jsonFinish();
	IDManager.register(block);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:28,代码来源:BlockJson.java

示例15: parseMetaElement

import com.eclipsesource.json.JsonObject.Member; //导入依赖的package包/类
private static <T> T[] parseMetaElement(JsonObject jsP, String name, T[] t, MetaElementParser<T> parser) {
	JsonValue j = jsP.get(name);
	if (j == null)
		return null;
	if (!j.isObject() || t.length == 1) {
		Arrays.fill(t, parser.parse(j));
	} else {
		JsonObject jsonObject = j.asObject();
		T defaultT = null;
		try {
			for (Member member : jsonObject) {
				String s = member.getName();
				if (s.equals("default")) {
					defaultT = parser.parse(member.getValue());
					continue;
				}
				int m = -1;

				m = Integer.parseInt(s);
				t[m] = null; // catch out of range exceptions

				t[m] = parser.parse(member.getValue());
			}
		} catch (Exception e) {
			throw new JsonException("Unexpected " + name + " member \"" + member.getName() + "\"");
		}
		parseMetaElementFor(t, defaultT, name);
	}
	return t;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:31,代码来源:BlockJson.java


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