Examples of TypePattern


Examples of org.codehaus.aspectwerkz.expression.regexp.TypePattern



    public Object visit(ASTArgParameter node, Object data) {

        TypePattern typePattern = node.getTypePattern();

        TypePattern realPattern = typePattern;



        // check if the arg is in the pointcut signature. In such a case, use the declared type
View Full Code Here

Examples of org.codehaus.aspectwerkz.expression.regexp.TypePattern



    public Object visit(ASTArgParameter node, Object data) {

        TypePattern typePattern = node.getTypePattern();

        ((List)data).add(typePattern.getPattern());

        return data;

    }
View Full Code Here

Examples of org.codehaus.aspectwerkz.expression.regexp.TypePattern

    public Object visit(ASTClassPattern node, Object data) {

        ClassInfo classInfo = (ClassInfo) data;

        TypePattern typePattern = node.getTypePattern();

        if (ClassInfoHelper.matchType(typePattern, classInfo)

            && visitAttributes(node, classInfo)
View Full Code Here

Examples of org.codehaus.aspectwerkz.expression.regexp.TypePattern

    }

    // ============ Patterns =============
    public Object visit(ASTClassPattern node, Object data) {
        ClassInfo classInfo = (ClassInfo) data;
        TypePattern typePattern = node.getTypePattern();
        if (ClassInfoHelper.matchType(typePattern, classInfo)
            && visitAttributes(node, classInfo)
            && visitModifiers(node, classInfo)) {
            return Boolean.TRUE;
        } else {
View Full Code Here

Examples of org.codehaus.aspectwerkz.expression.regexp.TypePattern

            }
        }
    }

    public Object visit(ASTArgParameter node, Object data) {
        TypePattern typePattern = node.getTypePattern();
        TypePattern realPattern = typePattern;

        // check if the arg is in the pointcut signature. In such a case, use the declared type
        //TODO can we improve that with a lazy attach of the realTypePattern to the node
        // and a method that always return the real pattern
        // It must be lazy since args are not added at info ctor time [can be refactored..]
View Full Code Here

Examples of org.codehaus.aspectwerkz.expression.regexp.TypePattern

    }
    // ============ Patterns =============
    public Object visit(ASTClassPattern node, Object data) {
        ClassInfo classInfo = (ClassInfo) data;
        TypePattern typePattern = node.getTypePattern();
        if (ClassInfoHelper.matchType(typePattern, classInfo) && visitAttributes(node, classInfo)) {
            return Boolean.TRUE;
        } else {
            return Boolean.FALSE;
        }
View Full Code Here

Examples of org.lilyproject.indexer.model.indexerconf.TypePattern

import static org.junit.Assert.assertTrue;

public class TypePatternTest {
    @Test
    public void testNameWildcards() throws Exception {
        TypePattern pattern = new TypePattern("STR*");

        assertTrue(pattern.matches("STRING"));
        assertFalse(pattern.matches("STING"));

        pattern = new TypePattern("STR*<STR*>");
        assertTrue(pattern.matches("STRING<STRONG>"));

        pattern = new TypePattern("STR*<STR*<*>>");
        assertTrue(pattern.matches("STRING<STRONG<LONG>>"));
        assertTrue(pattern.matches("STRING<STRONG>"));

        // wildcards in names will mostly be used for the record type argument for records
        pattern = new TypePattern("RECORD<{namespace}*>");
        assertTrue(pattern.matches("RECORD<{namespace}foo>"));
        assertFalse(pattern.matches("RECORD<{othernamespace}foo>"));
    }
View Full Code Here

Examples of org.lilyproject.indexer.model.indexerconf.TypePattern

        assertFalse(pattern.matches("RECORD<{othernamespace}foo>"));
    }

    @Test
    public void testArgumentWildcards() throws Exception {
        TypePattern pattern = new TypePattern("LIST<STRING>");

        assertTrue(pattern.matches("LIST<STRING>"));
        assertFalse(pattern.matches("LIST<LONG>"));
        assertFalse(pattern.matches("LIST"));
        assertFalse(pattern.matches("LIST<LIST<STRING>>"));
        assertFalse(pattern.matches("FOO"));

        // no type arg
        pattern = new TypePattern("STRING");

        assertTrue(pattern.matches("STRING"));
        assertFalse(pattern.matches("STRING<STRING>"));

        // optional 1 nested type argument
        pattern = new TypePattern("LIST<*>");

        assertTrue(pattern.matches("LIST"));
        assertTrue(pattern.matches("LIST<STRING>"));
        assertFalse(pattern.matches("LIST<LIST<STRING>>"));

        // this shows this can also match nested lists, which may go a bit beyond the purpose as this kind
        // of matching should serve to guarantee 1-level nested types. However, in practice this won't occur
        // since a list always has a type argument.
        assertTrue(pattern.matches("LIST<LIST>"));

        // exactly 1 nested type argument
        pattern = new TypePattern("LIST<+>");

        assertTrue(pattern.matches("LIST<STRING>"));
        assertFalse(pattern.matches("LIST"));
        assertFalse(pattern.matches("LIST<LIST<STRING>>"));

        // optionally any number of nested type arguments, including 0
        pattern = new TypePattern("LIST<**>");

        assertTrue(pattern.matches("LIST"));
        assertFalse(pattern.matches("STRING"));
        assertTrue(pattern.matches("LIST<STRING>"));
        assertTrue(pattern.matches("LIST<LIST<STRING>>"));
        assertTrue(pattern.matches("LIST<LIST<PATH<STRING>>>"));

        // optionally any number of nested type arguments, but at least 1
        pattern = new TypePattern("LIST<++>");

        assertFalse(pattern.matches("STRING"));
        assertTrue(pattern.matches("LIST<STRING>"));
        assertTrue(pattern.matches("LIST<LIST<STRING>>"));
        assertTrue(pattern.matches("LIST<LIST<PATH<STRING>>>"));

        // exactly 1 nested type argument at a deeper level
        pattern = new TypePattern("LIST<LIST<+>>");

        assertTrue(pattern.matches("LIST<LIST<STRING>>"));
        assertTrue(pattern.matches("LIST<LIST<LONG>>"));
        assertFalse(pattern.matches("LIST<LIST<LIST<LONG>>>"));
    }
View Full Code Here

Examples of org.lilyproject.indexer.model.indexerconf.TypePattern

        assertFalse(pattern.matches("LIST<LIST<LIST<LONG>>>"));
    }

    @Test
    public void testMultiPatterns() throws Exception {
        TypePattern pattern = new TypePattern("STRING,LONG,DATE");

        assertTrue(pattern.matches("STRING"));
        assertTrue(pattern.matches("LONG"));
        assertTrue(pattern.matches("DATE"));
        assertFalse(pattern.matches("RECORD"));


        pattern = new TypePattern("STRING,LIST<STRING>");
        assertTrue(pattern.matches("STRING"));
        assertTrue(pattern.matches("LIST<STRING>"));
        assertFalse(pattern.matches("RECORD"));
    }
View Full Code Here

Examples of org.lilyproject.indexer.model.indexerconf.TypePattern

    }

    @Test
    public void testMore() throws Exception {
        // match things and lists of things
        TypePattern pattern = new TypePattern("*,LIST<+>");

        assertTrue(pattern.matches("STRING"));
        assertTrue(pattern.matches("DATE"));
        assertTrue(pattern.matches("LIST<STRING>"));
        assertFalse(pattern.matches("LIST<LIST<STRING>>"));
        assertFalse(pattern.matches("STRING<STRING>"));
    }
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.