com.badlogic.gdx.utils.Json.setUsePrototypes()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中com.badlogic.gdx.utils.Json.setUsePrototypes()方法的一些代码示例,展示了Json.setUsePrototypes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.setUsePrototypes()方法的具体详情如下:
包路径:com.badlogic.gdx.utils.Json
类名称:Json
方法名:setUsePrototypes

Json.setUsePrototypes介绍

[英]When true, field values that are identical to a newly constructed instance are not written. Default is true.
[中]如果为true,则不会写入与新构造的实例相同的字段值。默认值为true。

代码示例

代码示例来源:origin: libgdx/libgdx

private void testObjectGraph (TestMapGraph object, String typeName) {
  Json json = new Json();
  json.setTypeName(typeName);
  json.setUsePrototypes(false);
  json.setIgnoreUnknownFields(true);
  json.setOutputType(OutputType.json);
  String text = json.prettyPrint(object);
  TestMapGraph object2 = json.fromJson(TestMapGraph.class, text);
  if (object2.map.size() != object.map.size()) {
    throw new RuntimeException("Too many items in deserialized json map.");
  }
  if (object2.objectMap.size != object.objectMap.size) {
    throw new RuntimeException("Too many items in deserialized json object map.");
  }
  if (object2.arrayMap.size != object.arrayMap.size) {
    throw new RuntimeException("Too many items in deserialized json map.");
  }
}

代码示例来源:origin: libgdx/libgdx

json.setUsePrototypes(false);

代码示例来源:origin: libgdx/libgdx

json.setUsePrototypes(false);

代码示例来源:origin: junkdog/artemis-odb

public JsonArtemisSerializer setUsePrototypes(boolean usePrototypes) {
  json.setUsePrototypes(usePrototypes);
  entitySerializer.setUsePrototypes(usePrototypes);
  return this;
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

json.setUsePrototypes(false);

相关文章