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


Java ConfigurationSerialization.deserializeObject方法代码示例

本文整理汇总了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);
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:19,代码来源:ConfigurationSerializableAdapter.java

示例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;
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:24,代码来源:YamlConstructor.java

示例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);
}
 
开发者ID:lucko,项目名称:helper,代码行数:7,代码来源:BukkitSerializableAdapterFactory.java


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