當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。