Package org.apache.tapestry.util

Examples of org.apache.tapestry.util.RegexpMatcher


    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

        private RegexpMatcher _matcher;

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

            return _matcher;
        }
View Full Code Here

    }

    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

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

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

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

        try
        {
            m.matches("[[[", "x");

            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
View Full Code Here

        }
    }

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

        m.clear();
    }
View Full Code Here

        m.clear();
    }

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

        assertTrue(m.contains("[a-z]+", "c"));
        assertTrue(m.contains("^(\\d{5}(-\\d{4})?)$", "06514"));
        assertTrue(m.contains("^(\\d{5}(-\\d{4})?)$", "06514-3149"));
        assertTrue(m.contains("foo|foot", "12foot12"));
    }
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.