本文整理汇总了Java中org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeObject方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationSerialization.deserializeObject方法的具体用法?Java ConfigurationSerialization.deserializeObject怎么用?Java ConfigurationSerialization.deserializeObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.configuration.serialization.ConfigurationSerialization
的用法示例。
在下文中一共展示了ConfigurationSerialization.deserializeObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.bukkit.configuration.serialization.ConfigurationSerialization; //导入方法依赖的package包/类
public static ConfigurationSerializable deserialize(Map<String, Object> map) {
if (map == null)
return null;
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
Object val = entry.getValue();
if (!(val instanceof Map))
continue;
Map<String, Object> subMap = (Map<String, Object>) val;
if (subMap.containsKey(SERIALIZED_TYPE_KEY)) {
map.put(key, deserialize(subMap));
}
}
return ConfigurationSerialization.deserializeObject(map);
}
示例2: construct
import org.bukkit.configuration.serialization.ConfigurationSerialization; //导入方法依赖的package包/类
@Override
public Object construct(Node node) {
if (node.isTwoStepsConstruction()) {
throw new YAMLException("Unexpected referential mapping structure. Node: " + node);
}
Map<?, ?> raw = (Map<?, ?>) super.construct(node);
if (raw.containsKey(ConfigurationSerialization.SERIALIZED_TYPE_KEY)) {
Map<String, Object> typed = new LinkedHashMap<String, Object>(raw.size());
for (Map.Entry<?, ?> entry : raw.entrySet()) {
typed.put(entry.getKey().toString(), entry.getValue());
}
try {
return ConfigurationSerialization.deserializeObject(typed);
} catch (IllegalArgumentException ex) {
throw new YAMLException("Could not deserialize object", ex);
}
}
return raw;
}
示例3: read
import org.bukkit.configuration.serialization.ConfigurationSerialization; //导入方法依赖的package包/类
@Override
public ConfigurationSerializable read(JsonReader in) {
Map<String, Object> map = gson.fromJson(in, RAW_OUTPUT_TYPE);
deserializeChildren(map);
return ConfigurationSerialization.deserializeObject(map);
}