Package org.apache.camel.language.tokenizer

Examples of org.apache.camel.language.tokenizer.TokenizeLanguage


        this.includeTokens = includeTokens;
    }

    @Override
    public Expression createExpression(CamelContext camelContext) {
        TokenizeLanguage language = new TokenizeLanguage();
        language.setToken(token);
        language.setEndToken(endToken);
        language.setInheritNamespaceTagName(inheritNamespaceTagName);
        language.setHeaderName(headerName);
        if (regex != null) {
            language.setRegex(regex);
        }
        if (xml != null) {
            language.setXml(xml);
        }
        if (includeTokens != null) {
            language.setIncludeTokens(includeTokens);
        }
        return language.createExpression();
    }
View Full Code Here


        assertEquals("Camel", names.get(0));
        assertEquals("rocks", names.get(1));
    }

    public void testTokenizeManualConfiguration() throws Exception {
        TokenizeLanguage lan = new TokenizeLanguage();
        lan.setHeaderName("names");
        lan.setRegex(false);
        lan.setToken(",");
        Expression exp = lan.createExpression();

        List names = exp.evaluate(exchange, List.class);
        assertEquals(3, names.size());

        assertEquals("Claus", names.get(0));
        assertEquals("James", names.get(1));
        assertEquals("Willem", names.get(2));

        assertEquals("names", lan.getHeaderName());
        assertEquals(",", lan.getToken());
        assertEquals(false, lan.isRegex());
        assertEquals(false, lan.isSingleton());
    }
View Full Code Here

        return regex;
    }

    @Override
    public Expression createExpression(CamelContext camelContext) {
        TokenizeLanguage language = new TokenizeLanguage();
        language.setToken(token);
        language.setHeaderName(headerName);
        if (regex != null) {
            language.setRegex(regex);
        }
        return language.createExpression();
    }
View Full Code Here

        return regex;
    }

    @Override
    public Expression createExpression(RouteContext routeContext) {
        TokenizeLanguage language = new TokenizeLanguage();
        language.setToken(token);
        language.setHeaderName(headerName);
        if (regex != null) {
            language.setRegex(regex);
        }
        return language.createExpression();
    }
View Full Code Here

        assertEquals("Camel", names.get(0));
        assertEquals("rocks", names.get(1));
    }

    public void testTokenizeManualConfiguration() throws Exception {
        TokenizeLanguage lan = new TokenizeLanguage();
        lan.setHeaderName("names");
        lan.setRegex(false);
        lan.setToken(",");
        Expression exp = lan.createExpression();

        List<?> names = exp.evaluate(exchange, List.class);
        assertEquals(3, names.size());

        assertEquals("Claus", names.get(0));
        assertEquals("James", names.get(1));
        assertEquals("Willem", names.get(2));

        assertEquals("names", lan.getHeaderName());
        assertEquals(",", lan.getToken());
        assertEquals(false, lan.isRegex());
        assertEquals(false, lan.isSingleton());
    }
View Full Code Here

        assertEquals("Camel", names.get(0));
        assertEquals("rocks", names.get(1));
    }

    public void testTokenizeManualConfiguration() throws Exception {
        TokenizeLanguage lan = new TokenizeLanguage();
        lan.setHeaderName("names");
        lan.setRegex(false);
        lan.setToken(",");
        Expression exp = lan.createExpression();

        List names = exp.evaluate(exchange, List.class);
        assertEquals(3, names.size());

        assertEquals("Claus", names.get(0));
        assertEquals("James", names.get(1));
        assertEquals("Willem", names.get(2));

        assertEquals("names", lan.getHeaderName());
        assertEquals(",", lan.getToken());
        assertEquals(false, lan.isRegex());
        assertEquals(false, lan.isSingleton());
    }
View Full Code Here

        assertEquals("Camel", names.get(0));
        assertEquals("rocks", names.get(1));
    }

    public void testTokenizeManualConfiguration() throws Exception {
        TokenizeLanguage lan = new TokenizeLanguage();
        lan.setHeaderName("names");
        lan.setRegex(false);
        lan.setToken(",");
        Expression exp = lan.createExpression();

        List names = exp.evaluate(exchange, List.class);
        assertEquals(3, names.size());

        assertEquals("Claus", names.get(0));
        assertEquals("James", names.get(1));
        assertEquals("Willem", names.get(2));

        assertEquals("names", lan.getHeaderName());
        assertEquals(",", lan.getToken());
        assertEquals(false, lan.isRegex());
        assertEquals(false, lan.isSingleton());
    }
View Full Code Here

        return regex;
    }

    @Override
    public Expression createExpression(CamelContext camelContext) {
        TokenizeLanguage language = new TokenizeLanguage();
        language.setToken(token);
        language.setHeaderName(headerName);
        if (regex != null) {
            language.setRegex(regex);
        }
        return language.createExpression();
    }
View Full Code Here

        return regex;
    }

    @Override
    public Expression createExpression(CamelContext camelContext) {
        TokenizeLanguage language = new TokenizeLanguage();
        language.setToken(token);
        language.setEndToken(endToken);
        language.setHeaderName(headerName);
        if (regex != null) {
            language.setRegex(regex);
        }
        return language.createExpression();
    }
View Full Code Here

        // special for new line tokens, if defined from XML then its 2 characters, so we replace that back to a single char
        if (token.startsWith("\\n")) {
            token = '\n' + token.substring(2);
        }

        TokenizeLanguage language = new TokenizeLanguage();
        language.setToken(token);
        language.setEndToken(endToken);
        language.setInheritNamespaceTagName(inheritNamespaceTagName);
        language.setHeaderName(headerName);
        if (regex != null) {
            language.setRegex(regex);
        }
        if (xml != null) {
            language.setXml(xml);
        }
        if (includeTokens != null) {
            language.setIncludeTokens(includeTokens);
        }
        if (group != null) {
            if (group <= 0) {
                throw new IllegalArgumentException("Group must be a positive number, was: " + group);
            }
            language.setGroup(group);
        }
        return language.createExpression();
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.language.tokenizer.TokenizeLanguage

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.