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


Java ConfigValue.origin方法代码示例

本文整理汇总了Java中com.typesafe.config.ConfigValue.origin方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigValue.origin方法的具体用法?Java ConfigValue.origin怎么用?Java ConfigValue.origin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.typesafe.config.ConfigValue的用法示例。


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

示例1: invalidValue

import com.typesafe.config.ConfigValue; //导入方法依赖的package包/类
private SwiftConfigException invalidValue(ConfigValue value, String k, Object v, ConfigPropertyType<?> t) {
    switch (t.toString().charAt(0)) {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
            return new SwiftConfigException(value.origin(), "invalid value '" + v + "' for property '" + k + "'. Expected an " + t);
        default:
            return new SwiftConfigException(value.origin(), "invalid value '" + v + "' for property '" + k + "'. Expected a " + t);
    }
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:13,代码来源:SwiftConfigSchema.java

示例2: getTokenLocation

import com.typesafe.config.ConfigValue; //导入方法依赖的package包/类
@Override
public JsonLocation getTokenLocation() {
    ConfigValue current = currentConfig();
    if (current == null) {
        return JsonLocation.NA;
    }
    ConfigOrigin nodeOrigin = current.origin();
    return new JsonLocation(current, -1, nodeOrigin.lineNumber(), -1);
}
 
开发者ID:addthis,项目名称:codec,代码行数:10,代码来源:ConfigTraversingParser.java

示例3: checkType

import com.typesafe.config.ConfigValue; //导入方法依赖的package包/类
private void checkType(String name, ConfigValue value, ConfigValueType type) {
    if (!type.equals(value.valueType())) {
        throw new SwiftConfigException(value.origin(), 
            "'" + name + "': wrong type (" + value.valueType() + "). Must be a " + type);
    }
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:7,代码来源:SwiftConfig.java

示例4: fromConfigValue

import com.typesafe.config.ConfigValue; //导入方法依赖的package包/类
public static JsonLocation fromConfigValue(ConfigValue configValue) {
    ConfigOrigin configOrigin = configValue.origin();
    return new JsonLocation(configValue, -1, configOrigin.lineNumber(), -1);
}
 
开发者ID:addthis,项目名称:codec,代码行数:5,代码来源:Jackson.java

示例5: PluginMap

import com.typesafe.config.ConfigValue; //导入方法依赖的package包/类
public PluginMap(@Nonnull String category, @Nonnull Config config) {
    this.config = config;
    this.category = checkNotNull(category);
    classField = config.getString("_field");
    boolean errorMissing = config.getBoolean("_strict");
    if (config.hasPath("_class")) {
        String baseClassName = config.getString("_class");
        try {
            baseClass = Class.forName(baseClassName);
        } catch (ClassNotFoundException e) {
            log.error("could not find specified base class {} for category {}",
                      baseClassName, category);
            throw new RuntimeException(e);
        }
    } else {
        baseClass = null;
    }
    Set<String> labels = config.root().keySet();
    BiMap<String, Class<?>> mutableMap = HashBiMap.create(labels.size());
    Map<String, String> mutableAliasMap = new HashMap<>();
    Set<String> mutableInlinedAliasSet = new HashSet<>();
    for (String label : labels) {
        if (!((label.charAt(0) != '_') || "_array".equals(label) || "_default".equals(label))) {
            continue;
        }
        ConfigValue configValue = config.root().get(label);
        String className;
        if (configValue.valueType() == ConfigValueType.STRING) {
            className = (String) configValue.unwrapped();
        } else if (configValue.valueType() == ConfigValueType.OBJECT) {
            ConfigObject configObject = (ConfigObject) configValue;
            className = configObject.toConfig().getString("_class");
            if (configObject.toConfig().hasPath("_inline") &&
                    configObject.toConfig().getBoolean("_inline")) {
                mutableInlinedAliasSet.add(label);
            }
        } else if (configValue.valueType() == ConfigValueType.NULL) {
            continue;
        } else {
            throw new ConfigException.WrongType(configValue.origin(), label,
                                                "STRING OR OBJECT", configValue.valueType().toString());
        }
        if (labels.contains(className)) {
            // points to another alias
            mutableAliasMap.put(label, className);
        } else {
            try {
                Class<?> foundClass = findAndValidateClass(className);
                mutableMap.put(label, foundClass);
            } catch (ClassNotFoundException maybeSwallowed) {
                if (errorMissing) {
                    throw new RuntimeException(maybeSwallowed);
                } else {
                    log.warn("plugin category {} with alias {} is pointing to missing class {}",
                             category, label, className);
                }
            }
        }
    }
    map = Maps.unmodifiableBiMap(mutableMap);
    aliases = Collections.unmodifiableMap(mutableAliasMap);
    checkAliasesForCycles();
    inlinedAliases = Collections.unmodifiableSet(mutableInlinedAliasSet);
}
 
开发者ID:addthis,项目名称:codec,代码行数:65,代码来源:PluginMap.java

示例6: getTokenLocation

import com.typesafe.config.ConfigValue; //导入方法依赖的package包/类
@Override
public JsonLocation getTokenLocation() {
    final ConfigValue node = currentNode();
    return node == null ? JsonLocation.NA : new HoconJsonLocation(node.origin());
}
 
开发者ID:jclawson,项目名称:jackson-dataformat-hocon,代码行数:6,代码来源:HoconTreeTraversingParser.java

示例7: getCurrentLocation

import com.typesafe.config.ConfigValue; //导入方法依赖的package包/类
@Override
public JsonLocation getCurrentLocation() {
    final ConfigValue node = currentNode();
    return node == null ? JsonLocation.NA : new HoconJsonLocation(node.origin());
}
 
开发者ID:jclawson,项目名称:jackson-dataformat-hocon,代码行数:6,代码来源:HoconTreeTraversingParser.java


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