Package com.crashnote.external.config

Examples of com.crashnote.external.config.ConfigValue


    @Override
    public AbstractConfigValue withFallback(final ConfigMergeable mergeable) {
        if (ignoresFallbacks()) {
            return this;
        } else {
            final ConfigValue other = ((MergeableValue) mergeable).toFallbackValue();

            if (other instanceof Unmergeable) {
                return mergedWithTheUnmergeable((Unmergeable) other);
            } else if (other instanceof AbstractConfigObject) {
                return mergedWithObject((AbstractConfigObject) other);
View Full Code Here



    @Override
    public boolean hasPath(final String pathExpression) {
        final Path path = Path.newPath(pathExpression);
        final ConfigValue peeked;
        try {
            peeked = object.peekPath(path);
        } catch (ConfigException.NotResolved e) {
            throw ConfigImpl.improveNotResolved(path, e);
        }
        return peeked != null && peeked.valueType() != ConfigValueType.NULL;
    }
View Full Code Here

    private static void findPaths(final Set<Map.Entry<String, ConfigValue>> entries, final Path parent,
            final AbstractConfigObject obj) {
        for (final Map.Entry<String, ConfigValue> entry : obj.entrySet()) {
            final String elem = entry.getKey();
            final ConfigValue v = entry.getValue();
            Path path = Path.newKey(elem);
            if (parent != null)
                path = path.prepend(parent);
            if (v instanceof AbstractConfigObject) {
                findPaths(entries, path, (AbstractConfigObject) v);
View Full Code Here

        return find(path, null);
    }

    @Override
    public boolean getBoolean(final String path) {
        final ConfigValue v = find(path, ConfigValueType.BOOLEAN);
        return (Boolean) v.unwrapped();
    }
View Full Code Here

        final ConfigValue v = find(path, ConfigValueType.BOOLEAN);
        return (Boolean) v.unwrapped();
    }

    private ConfigNumber getConfigNumber(final String path) {
        final ConfigValue v = find(path, ConfigValueType.NUMBER);
        return (ConfigNumber) v;
    }
View Full Code Here

        return getNumber(path).doubleValue();
    }

    @Override
    public String getString(final String path) {
        final ConfigValue v = find(path, ConfigValueType.STRING);
        return (String) v.unwrapped();
    }
View Full Code Here

        return getObject(path).toConfig();
    }

    @Override
    public Object getAnyRef(final String path) {
        final ConfigValue v = find(path, null);
        return v.unwrapped();
    }
View Full Code Here

    public Long getBytes(final String path) {
        Long size = null;
        try {
            size = getLong(path);
        } catch (ConfigException.WrongType e) {
            final ConfigValue v = find(path, ConfigValueType.STRING);
            size = parseBytes((String) v.unwrapped(),
                    v.origin(), path);
        }
        return size;
    }
View Full Code Here

    public Long getNanoseconds(final String path) {
        Long ns = null;
        try {
            ns = TimeUnit.MILLISECONDS.toNanos(getLong(path));
        } catch (ConfigException.WrongType e) {
            final ConfigValue v = find(path, ConfigValueType.STRING);
            ns = parseDuration((String) v.unwrapped(), v.origin(), path);
        }
        return ns;
    }
View Full Code Here

    @Override
    public AbstractConfigValue withFallback(final ConfigMergeable mergeable) {
        if (ignoresFallbacks()) {
            return this;
        } else {
            final ConfigValue other = ((MergeableValue) mergeable).toFallbackValue();

            if (other instanceof Unmergeable) {
                return mergedWithTheUnmergeable((Unmergeable) other);
            } else if (other instanceof AbstractConfigObject) {
                return mergedWithObject((AbstractConfigObject) other);
View Full Code Here

TOP

Related Classes of com.crashnote.external.config.ConfigValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.