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

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

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

Json.readFields介绍

暂无

代码示例

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

void merge (Settings settings, File settingsFile) {
  try {
    json.readFields(settings, new JsonReader().parse(new FileReader(settingsFile)));
  } catch (Exception ex) {
    throw new GdxRuntimeException("Error reading settings file: " + settingsFile, ex);
  }
}

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

void merge (Settings settings, File settingsFile) {
  try {
    json.readFields(settings, new JsonReader().parse(new FileReader(settingsFile)));
  } catch (Exception ex) {
    throw new GdxRuntimeException("Error reading settings file: " + settingsFile, ex);
  }
}

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

public void readFields (Object object, JsonValue jsonMap) {
    if (jsonMap.has(parentFieldName)) {
      String parentName = readValue(parentFieldName, String.class, jsonMap);
      Class parentType = object.getClass();
      while (true) {
        try {
          copyFields(get(parentName, parentType), object);
          break;
        } catch (GdxRuntimeException ex) { // Parent resource doesn't exist.
          parentType = parentType.getSuperclass(); // Try resource for super class.
          if (parentType == Object.class) {
            SerializationException se = new SerializationException(
              "Unable to find parent resource with name: " + parentName);
            se.addTrace(jsonMap.child.trace());
            throw se;
          }
        }
      }
    }
    super.readFields(object, jsonMap);
  }
};

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

public void readFields (Object object, JsonValue jsonMap) {
    if (jsonMap.has(parentFieldName)) {
      String parentName = readValue(parentFieldName, String.class, jsonMap);
      Class parentType = object.getClass();
      while (true) {
        try {
          copyFields(get(parentName, parentType), object);
          break;
        } catch (GdxRuntimeException ex) { // Parent resource doesn't exist.
          parentType = parentType.getSuperclass(); // Try resource for super class.
          if (parentType == Object.class) {
            SerializationException se = new SerializationException(
              "Unable to find parent resource with name: " + parentName);
            se.addTrace(jsonMap.child.trace());
            throw se;
          }
        }
      }
    }
    super.readFields(object, jsonMap);
  }
};

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

readFields(object, jsonData);
return (T)object;

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

readFields(object, jsonData);
return (T)object;

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

private void readComponent(Json json, JsonValue component, Component c) {
  json.readFields(c, component);
  // if component contains entity references, add
  // entity reference operations
  referenceTracker.addEntityReferencingComponent(c);
}

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

void merge (Settings settings, File settingsFile) {
  try {
    json.readFields(settings, new JsonReader().parse(new FileReader(settingsFile)));
  } catch (Exception ex) {
    throw new GdxRuntimeException("Error reading settings file: " + settingsFile, ex);
  }
}

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

public void readFields (Object object, JsonValue jsonMap) {
    if (jsonMap.has(parentFieldName)) {
      String parentName = readValue(parentFieldName, String.class, jsonMap);
      Class parentType = object.getClass();
      while (true) {
        try {
          copyFields(get(parentName, parentType), object);
          break;
        } catch (GdxRuntimeException ex) { // Parent resource doesn't exist.
          parentType = parentType.getSuperclass(); // Try resource for super class.
          if (parentType == Object.class) {
            SerializationException se = new SerializationException(
              "Unable to find parent resource with name: " + parentName);
            se.addTrace(jsonMap.child.trace());
            throw se;
          }
        }
      }
    }
    super.readFields(object, jsonMap);
  }
};

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

public <T extends SaveFileFormat> T load(JsonValue jsonData, Class<T> format) {
  entitySerializer.preLoad();
  SaveFileFormat partial = partialLoad(jsonData);
  referenceTracker.inspectTypes(partial.componentIdentifiers.getTypes());
  entitySerializer.factory.configureWith(countChildren(jsonData.get("entities")));
  T t = newInstance(format);
  json.readFields(t, jsonData);
  t.tracker = entitySerializer.keyTracker;
  referenceTracker.translate(intBagEntitySerializer.getTranslatedIds());
  return t;
}

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

readFields(object, jsonData);
return (T)object;

相关文章