Package org.apache.commons.configuration2.tree

Examples of org.apache.commons.configuration2.tree.DefaultExpressionEngine


     * @param keyLast the last processed key
     * @param keyAct the actual key
     */
    protected void closeElements(DefaultConfigurationKey keyLast, DefaultConfigurationKey keyAct)
    {
        DefaultConfigurationKey keyDiff = keyAct.differenceKey(keyLast);
        Iterator<String> it = reverseIterator(keyDiff);
        if (it.hasNext())
        {
            // Skip first because it has already been closed by fireValue()
            it.next();
View Full Code Here


     */
    protected String openElements(DefaultConfigurationKey keyLast, DefaultConfigurationKey keyAct,
            Configuration config, Set<String> keySet)
    {
        DefaultConfigurationKey.KeyIterator it = keyLast.differenceKey(keyAct).iterator();
        DefaultConfigurationKey k = keyLast.commonKey(keyAct);
        for (it.nextKey(); it.hasNext(); it.nextKey())
        {
            k.append(it.currentKey(true));
            elementStart(it.currentKey(true), config.getProperty(k.toString()));
            keySet.add(k.toString());
        }
        return it.currentKey(true);
    }
View Full Code Here

     */
    public void process(Configuration config)
    {
        if (config != null)
        {
            DefaultExpressionEngine exprEngine = DefaultExpressionEngine.INSTANCE;
            DefaultConfigurationKey keyEmpty =
                    new DefaultConfigurationKey(exprEngine);
            DefaultConfigurationKey keyLast = keyEmpty;
            Set<String> keySet = new HashSet<String>();

View Full Code Here

    {
        PropertiesConfiguration child = new PropertiesConfiguration();
        child.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        child.addProperty("test(a)", "1,2,3");
        config.addConfiguration(child);
        DefaultExpressionEngine engineQuery =
                new DefaultExpressionEngine(
                        new DefaultExpressionEngineSymbols.Builder(
                                DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS)
                                .setIndexStart("<").setIndexEnd(">").create());
        config.setExpressionEngine(engineQuery);
        DefaultExpressionEngine engineConvert =
                new DefaultExpressionEngine(
                        new DefaultExpressionEngineSymbols.Builder(
                                DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS)
                                .setIndexStart("[").setIndexEnd("]").create());
        config.setConversionExpressionEngine(engineConvert);
        assertEquals("Wrong property 1", "1", config.getString("test(a)<0>"));
View Full Code Here

     */
    @Test
    public void testSetConversionExpressionEngineSynchronized()
    {
        SynchronizerTestImpl sync = setUpSynchronizerTest();
        config.setConversionExpressionEngine(new DefaultExpressionEngine(
                DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS));
        sync.verify(Methods.BEGIN_WRITE, Methods.END_WRITE);
        checkCombinedRootNotConstructed();
    }
View Full Code Here

    public void testConvertToHierarchicalEngine()
    {
        Configuration conf = new BaseConfiguration();
        conf.addProperty("test(a)", Boolean.TRUE);
        conf.addProperty("test(b)", Boolean.FALSE);
        DefaultExpressionEngine engine =
                new DefaultExpressionEngine(
                        new DefaultExpressionEngineSymbols.Builder(
                                DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS)
                                .setIndexStart("[").setIndexEnd("]").create());
        HierarchicalConfiguration<?> hc = ConfigurationUtils
                .convertToHierarchical(conf, engine);
View Full Code Here

    @Test
    public void testConvertHierarchicalToHierarchicalEngine()
    {
        BaseHierarchicalConfiguration hc = new BaseHierarchicalConfiguration();
        ExpressionEngine engine =
                new DefaultExpressionEngine(
                        DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS);
        assertSame("Created new configuration", hc, ConfigurationUtils
                .convertToHierarchical(hc, engine));
        assertSame("Engine was not set", engine, hc.getExpressionEngine());
    }
View Full Code Here

    @Test
    public void testConvertHierarchicalToHierarchicalNullEngine()
    {
        BaseHierarchicalConfiguration hc = new BaseHierarchicalConfiguration();
        ExpressionEngine engine =
                new DefaultExpressionEngine(
                        DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS);
        hc.setExpressionEngine(engine);
        assertSame("Created new configuration", hc, ConfigurationUtils
                .convertToHierarchical(hc, null));
        assertSame("Expression engine was changed", engine, hc
View Full Code Here

        }
    }

    private ExpressionEngine createAlternativeExpressionEngine()
    {
        return new DefaultExpressionEngine(
                new DefaultExpressionEngineSymbols.Builder(
                        DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS)
                        .setPropertyDelimiter("/").setIndexStart("[")
                        .setIndexEnd("]").create());
    }
View Full Code Here

        BufferedReader bufferedReader = new BufferedReader(in);
        Map<String, ImmutableNode.Builder> sectionBuilders = new LinkedHashMap<String, ImmutableNode.Builder>();
        ImmutableNode.Builder rootBuilder = new ImmutableNode.Builder();

        createNodeBuilders(bufferedReader, rootBuilder, sectionBuilders);
        ImmutableNode rootNode = createNewRootNode(rootBuilder, sectionBuilders);
        addNodes(null, rootNode.getChildren());
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.tree.DefaultExpressionEngine

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.