Package org.codehaus.aspectwerkz.regexp

Examples of org.codehaus.aspectwerkz.regexp.PatternTuple


    /**
     * Compiles the pattern for the expression.
     */
    protected void compilePattern() {
        PatternTuple tuple = null;
        if (m_type == null) {
            throw new ExpressionException("pointcut type in context can not be null");
        }
        if (m_type.equals(PointcutType.EXECUTION)) {
            if (Pattern.isConstructor(m_expression)) {
                tuple = PatternFactory.createConstructorPatternTuple(m_expression, m_package);
                m_memberPattern = Pattern.compileConstructorPattern(tuple.getMemberPattern());
            }
            else {
                tuple = PatternFactory.createMethodPatternTuple(m_expression, m_package);
                m_memberPattern = Pattern.compileMethodPattern(tuple.getMemberPattern());
            }
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.CALL)) {
            if (Pattern.isConstructor(m_expression)) {
                tuple = PatternFactory.createCallPatternTuple(Pattern.CONSTRUCTOR, m_expression, m_package);
                m_memberPattern = Pattern.compileCallerSidePattern(Pattern.CONSTRUCTOR, tuple.getMemberPattern());
            }
            else {
                tuple = PatternFactory.createCallPatternTuple(Pattern.METHOD, m_expression, m_package);
                m_memberPattern = Pattern.compileCallerSidePattern(Pattern.METHOD, tuple.getMemberPattern());
            }
            m_isHierarchical = tuple.isHierarchical();
            m_isHierarchicalCallee = tuple.isHierarchicalCallee();
            m_classPattern = Pattern.compileClassPattern(tuple.getCallerClassPattern());
        }
        else if (m_type.equals(PointcutType.SET) || m_type.equals(PointcutType.GET)) {
            tuple = PatternFactory.createFieldPatternTuple(m_expression, m_package);
            m_memberPattern = Pattern.compileFieldPattern(tuple.getMemberPattern());
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.CFLOW)) {
            // cflow compiled as caller side pattern
            if (Pattern.isConstructor(m_expression)) {
                tuple = PatternFactory.createCallPatternTuple(Pattern.CONSTRUCTOR, m_expression, m_package);
                m_memberPattern = Pattern.compileCallerSidePattern(Pattern.CONSTRUCTOR, tuple.getMemberPattern());
            }
            else {
                tuple = PatternFactory.createCallPatternTuple(Pattern.METHOD, m_expression, m_package);
                m_memberPattern = Pattern.compileCallerSidePattern(Pattern.METHOD, tuple.getMemberPattern());
            }
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.HANDLER)) {
            tuple = PatternFactory.createClassPatternTuple(m_expression, m_package);
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.CLASS)) {
            tuple = PatternFactory.createClassPatternTuple(m_expression, m_package);
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
    }
View Full Code Here


     * Compiles the pattern for the expression.
     *
     * @TODO: impl. CFLOW
     */
    protected void compilePattern() {
        PatternTuple tuple = null;
        if (m_type == null) {
            throw new ExpressionException("pointcut type in context can not be null");
        }
        if (m_type.equals(PointcutType.EXECUTION)) {
            tuple = PatternFactory.createMethodPatternTuple(m_expression, m_package);
            m_memberPattern = Pattern.compileMethodPattern(tuple.getMemberPattern());
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.CALL)) {
            tuple = PatternFactory.createCallPatternTuple(m_expression, m_package);
            m_memberPattern = Pattern.compileCallerSidePattern(tuple.getMemberPattern());
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCallerClassPattern());
        }
        else if (m_type.equals(PointcutType.SET) || m_type.equals(PointcutType.GET)) {
            tuple = PatternFactory.createFieldPatternTuple(m_expression, m_package);
            m_memberPattern = Pattern.compileFieldPattern(tuple.getMemberPattern());
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.THROWS)) {
            tuple = PatternFactory.createThrowsPatternTuple(m_expression, m_package);
            m_memberPattern = Pattern.compileThrowsPattern(tuple.getMemberPattern());
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.CFLOW)) {
            tuple = PatternFactory.createCallPatternTuple(m_expression, m_package);
            m_memberPattern = Pattern.compileCallerSidePattern(tuple.getMemberPattern());
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.CLASS)) {
            tuple = PatternFactory.createClassPatternTuple(m_expression, m_package);
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
    }
View Full Code Here

            if (classPattern.endsWith("+")) {
                classPattern = classPattern.substring(0, classPattern.length() - 1);
                isHierarchical = true;
            }

            return new PatternTuple(null, classPattern, classPattern, isHierarchical);
        }
        catch (Exception e) {
            throw new DefinitionException("class pattern is not well formed [" + pattern + "]");
        }
    }
View Full Code Here

            StringBuffer memberPattern = new StringBuffer();
            memberPattern.append(returnType);
            memberPattern.append(methodPattern);
            memberPattern.append(parameterTypes);

            return new PatternTuple(null, classPattern, memberPattern.toString(), isHierarchical);
        }
        catch (Exception e) {
            throw new DefinitionException("method pattern is not well formed [" + pattern + "]");
        }
    }
View Full Code Here

            StringBuffer memberPattern = new StringBuffer();
            memberPattern.append(fieldType);
            memberPattern.append(fieldPattern);

            return new PatternTuple(null, classPattern, memberPattern.toString(), isHierarchical);
        }
        catch (Exception e) {
            throw new DefinitionException("field pattern is not well formed [" + pattern + "]");
        }
    }
View Full Code Here

            memberPattern.append(methodPattern);
            memberPattern.append(parameterTypes);
            memberPattern.append('#');
            memberPattern.append(exceptionName);

            return new PatternTuple(null, classPattern, memberPattern.toString(), isHierarchical);
        }
        catch (Exception e) {
            throw new DefinitionException("throws pattern is not well formed [" + pattern + "]");
        }
    }
View Full Code Here

            buf.append(calleeClassPattern);
            buf.append(AspectWerkzDefinition.CALLER_SIDE_DELIMITER);
            buf.append(calleeMethodPattern);

            // TODO: should perhaps add both a caller class and callee class field in the tuple
            return new PatternTuple(callerClassPattern, calleeClassPattern, buf.toString(), isHierarchical);
        }
        catch (Exception e) {
            throw new DefinitionException("caller side pattern is not well formed [" + pattern + "]");
        }
    }
View Full Code Here

            StringBuffer buf = new StringBuffer();
            buf.append(calleeClassPattern);
            buf.append(SystemDefinition.CALLER_SIDE_DELIMITER);
            buf.append(calleeMethodPattern);

            return new PatternTuple(
                    callerClassPattern, calleeClassPattern, buf.toString(),
                    isHierarchical, isHierarchicalCallee
            );
        }
        catch (Exception e) {
View Full Code Here

    /**
     * Compiles the pattern for the expression.
     */
    protected void compilePattern() {
        PatternTuple tuple = null;
        if (m_type == null) {
            throw new ExpressionException("pointcut type in context can not be null");
        }
        if (m_type.equals(PointcutType.EXECUTION)) {
            if (Pattern.isConstructor(m_expression)) {
                tuple = PatternFactory.createConstructorPatternTuple(m_expression, m_package);
                m_memberPattern = Pattern.compileConstructorPattern(tuple.getMemberPattern());
            }
            else {
                tuple = PatternFactory.createMethodPatternTuple(m_expression, m_package);
                m_memberPattern = Pattern.compileMethodPattern(tuple.getMemberPattern());
            }
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.CALL)) {
            if (Pattern.isConstructor(m_expression)) {
                tuple = PatternFactory.createCallPatternTuple(Pattern.CONSTRUCTOR, m_expression, m_package);
                m_memberPattern = Pattern.compileCallerSidePattern(Pattern.CONSTRUCTOR, tuple.getMemberPattern());
            }
            else {
                tuple = PatternFactory.createCallPatternTuple(Pattern.METHOD, m_expression, m_package);
                m_memberPattern = Pattern.compileCallerSidePattern(Pattern.METHOD, tuple.getMemberPattern());
            }
            m_isHierarchical = tuple.isHierarchical();
            m_isHierarchicalCallee = tuple.isHierarchicalCallee();
            m_classPattern = Pattern.compileClassPattern(tuple.getCallerClassPattern());
        }
        else if (m_type.equals(PointcutType.SET) || m_type.equals(PointcutType.GET)) {
            tuple = PatternFactory.createFieldPatternTuple(m_expression, m_package);
            m_memberPattern = Pattern.compileFieldPattern(tuple.getMemberPattern());
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.CFLOW)) {
            // cflow compiled as caller side pattern
            if (Pattern.isConstructor(m_expression)) {
                tuple = PatternFactory.createCallPatternTuple(Pattern.CONSTRUCTOR, m_expression, m_package);
                m_memberPattern = Pattern.compileCallerSidePattern(Pattern.CONSTRUCTOR, tuple.getMemberPattern());
            }
            else {
                tuple = PatternFactory.createCallPatternTuple(Pattern.METHOD, m_expression, m_package);
                m_memberPattern = Pattern.compileCallerSidePattern(Pattern.METHOD, tuple.getMemberPattern());
            }
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.HANDLER)) {
            tuple = PatternFactory.createClassPatternTuple(m_expression, m_package);
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
        else if (m_type.equals(PointcutType.CLASS)) {
            tuple = PatternFactory.createClassPatternTuple(m_expression, m_package);
            m_isHierarchical = tuple.isHierarchical();
            m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
        }
    }
View Full Code Here

            if (classPattern.endsWith("+")) {
                classPattern = classPattern.substring(0, classPattern.length() - 1);
                isHierarchical = true;
            }

            return new PatternTuple(null, classPattern, classPattern, isHierarchical);
        }
        catch (Exception e) {
            throw new DefinitionException("class pattern is not well formed [" + pattern + ']');
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.regexp.PatternTuple

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.