Examples of ConfigurationInterpolator


Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

        boolean success;
        do
        {
            // do this in a loop because the ConfigurationInterpolator
            // instance may be changed by another thread
            ConfigurationInterpolator ciOld = getInterpolator();
            ConfigurationInterpolator ciNew =
                    (ciOld != null) ? ciOld : new ConfigurationInterpolator();
            ciNew.registerLookups(lookups);
            success = interpolator.compareAndSet(ciOld, ciNew);
        } while (!success);
    }
View Full Code Here

Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

    public void setDefaultLookups(Collection<? extends Lookup> lookups)
    {
        boolean success;
        do
        {
            ConfigurationInterpolator ciOld = getInterpolator();
            ConfigurationInterpolator ciNew =
                    (ciOld != null) ? ciOld : new ConfigurationInterpolator();
            Lookup confLookup = findConfigurationLookup(ciNew);
            if (confLookup == null)
            {
                confLookup = new ConfigurationLookup(this);
            }
            else
            {
                ciNew.removeDefaultLookup(confLookup);
            }
            ciNew.addDefaultLookups(lookups);
            ciNew.addDefaultLookup(confLookup);
            success = interpolator.compareAndSet(ciOld, ciNew);
        } while (!success);
    }
View Full Code Here

Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

    public void setParentInterpolator(ConfigurationInterpolator parent)
    {
        boolean success;
        do
        {
            ConfigurationInterpolator ciOld = getInterpolator();
            ConfigurationInterpolator ciNew =
                    (ciOld != null) ? ciOld : new ConfigurationInterpolator();
            ciNew.setParentInterpolator(parent);
            success = interpolator.compareAndSet(ciOld, ciNew);
        } while (!success);
    }
View Full Code Here

Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

     * @since 2.0
     */
    protected void cloneInterpolator(AbstractConfiguration orgConfig)
    {
        interpolator = new AtomicReference<ConfigurationInterpolator>();
        ConfigurationInterpolator orgInterpolator = orgConfig.getInterpolator();
        List<Lookup> defaultLookups = orgInterpolator.getDefaultLookups();
        Lookup lookup = findConfigurationLookup(orgInterpolator, orgConfig);
        if (lookup != null)
        {
            defaultLookups.remove(lookup);
        }

        installInterpolator(orgInterpolator.getLookups(), defaultLookups);
    }
View Full Code Here

Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

    }

    @Override
    public <T> T to(Object src, Class<T> targetCls, ConfigurationInterpolator ci)
    {
        ConfigurationInterpolator interpolator = fetchInterpolator(ci);
        return convert(interpolator.interpolate(src), targetCls, interpolator);
    }
View Full Code Here

Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

        if (isEmptyElement(src))
        {
            return Array.newInstance(elemClass, 0);
        }

        ConfigurationInterpolator interpolator = fetchInterpolator(ci);
        return elemClass.isPrimitive() ? toPrimitiveArray(src, elemClass,
                interpolator) : toObjectArray(src, elemClass, interpolator);
    }
View Full Code Here

Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

                    "Target collection must not be null!");
        }

        if (src != null && !isEmptyElement(src))
        {
            ConfigurationInterpolator interpolator = fetchInterpolator(ci);
            convertToCollection(src, elemClass, interpolator, dest);
        }
    }
View Full Code Here

Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

     * @param config the configuration to test
     */
    public static void testGetInterpolator(AbstractConfiguration config)
    {
        config.addProperty("var", "${echo:testVar}");
        ConfigurationInterpolator interpol = config.getInterpolator();
        interpol.registerLookup("echo", new Lookup()
        {
            @Override
            public Object lookup(String varName)
            {
                return "Value of variable " + varName;
View Full Code Here

Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

         * @return The normalized URI reference.
         */
        @Override
        protected String normalizeURI(String uriref)
        {
            ConfigurationInterpolator ci = ((CatalogManager) catalogManager).getInterpolator();
            String resolved = (ci != null) ? String.valueOf(ci.interpolate(uriref)) : uriref;
            return super.normalizeURI(resolved);
        }
View Full Code Here

Examples of org.apache.commons.configuration2.interpol.ConfigurationInterpolator

            lookups.put(key, lookup);
        }

        if (!lookups.isEmpty())
        {
            ConfigurationInterpolator defCI = defConfig.getInterpolator();
            if (defCI != null)
            {
                defCI.registerLookups(lookups);
            }
            resultConfig.getInterpolator().registerLookups(lookups);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.