Package org.apache.tapestry.util

Examples of org.apache.tapestry.util.RegexpMatcher


    }

    public RegexpMatcher getMatcher()
    {
        if (_matcher == null)
            _matcher = new RegexpMatcher();

        return _matcher;
    }
View Full Code Here


    public void validate(String value, String pattern, String errorKey)
        throws DocumentParseException
    {
        if (_matcher == null)
            _matcher = new RegexpMatcher();

        if (_matcher.matches(pattern, value))
            return;

        throw new InvalidStringException(Tapestry.format(errorKey, value), value, getLocation());
View Full Code Here

        private RegexpMatcher _matcher;

        private RegexpMatcher getPatternMatcher()
        {
            if (_matcher == null)
                _matcher = new RegexpMatcher();

            return _matcher;
        }
View Full Code Here

     * Invoked by hivemind by default to initialize
     * service.
     */
    public void initializeService()
    {
        _matcher = new RegexpMatcher();
    }
View Full Code Here

            return Collections.EMPTY_LIST;

        List result = new ArrayList();
        String chopped = specification;

        RegexpMatcher matcher = new RegexpMatcher();

        while (true)
        {
            if (chopped.length() == 0)
                break;

            if (!result.isEmpty())
            {
                if (chopped.charAt(0) != ',')
                    throw new ApplicationRuntimeException(ValidatorMessages
                            .badSpecification(specification));

                chopped = chopped.substring(1);
            }

            RegexpMatch[] matches = matcher.getMatches(PATTERN, chopped);

            if (matches.length != 1)
                throw new ApplicationRuntimeException(ValidatorMessages
                        .badSpecification(specification));
View Full Code Here

     */

    public void validate(String value, String pattern, String errorKey)
    {
        if (_matcher == null)
            _matcher = new RegexpMatcher();

        if (_matcher.matches(pattern, value))
            return;

        throw new InvalidStringException(Tapestry.format(errorKey, value), value, getLocation());
View Full Code Here

        private RegexpMatcher _matcher;

        private RegexpMatcher getPatternMatcher()
        {
            if (_matcher == null)
                _matcher = new RegexpMatcher();

            return _matcher;
        }
View Full Code Here

    public void validate(String value, String pattern, String errorKey)
            throws DocumentParseException
    {
        if (_matcher == null)
            _matcher = new RegexpMatcher();

        if (_matcher.matches(pattern, value))
            return;

        throw new InvalidStringException(Tapestry.format(errorKey, value), value, getLocation());
View Full Code Here

public class TestRegexpMatcher extends TapestryTestCase
{

    public void testMatch()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertTrue(m.matches("[a-z]+", "c"));
        assertTrue(m.matches("foo|foot", "foo"));
    }
View Full Code Here

        assertTrue(m.matches("foo|foot", "foo"));
    }

    public void testNonmatch()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertTrue(!m.matches("[0-9]+", "q"));
        assertTrue(!m.matches("foo|foot", "foot"));
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.util.RegexpMatcher

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.