Package org.codehaus.aspectwerkz.definition.expression

Examples of org.codehaus.aspectwerkz.definition.expression.Expression


        for (Iterator it = m_aspectMap.values().iterator(); it.hasNext();) {
            AspectDefinition aspectDef = (AspectDefinition)it.next();
            for (Iterator it2 = aspectDef.getAllAdvices().iterator(); it2.hasNext();) {
                AdviceDefinition adviceDef = (AdviceDefinition)it2.next();
                Expression expression = adviceDef.getExpression();
                if (expression.isOfType(PointcutType.CALL)
                    && expression.match(classMetaData, PointcutType.CALL)) {
                    return true;
                }
//                if (expression.isOfType(PointcutType.CFLOW)
//                    && expression.match(classMetaData, PointcutType.CFLOW)) {
//                    return true;
//                }
                if (expression.matchInOrNotIn(classMetaData)) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here


        for (Iterator it = m_aspectMap.values().iterator(); it.hasNext();) {
            AspectDefinition aspectDef = (AspectDefinition)it.next();
            for (Iterator it2 = aspectDef.getAllAdvices().iterator(); it2.hasNext();) {
                AdviceDefinition adviceDef = (AdviceDefinition)it2.next();
                Expression expression = adviceDef.getExpression();
                if (expression.isOfType(PointcutType.CALL)
                    && expression.match(classMetaData, memberMetaData, PointcutType.CALL)) {
                    return true;
                }
//                if (expression.isOfType(PointcutType.CFLOW)) {
//                    if (expression.match(classMetaData, memberMetaData, PointcutType.CFLOW)) {
//                    return true;
//                    }
//                }
                if (expression.matchInOrNotIn(classMetaData, memberMetaData)) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

        }

        List interfaceIntroductionDefs = new ArrayList();
        for (Iterator it = m_interfaceIntroductionMap.values().iterator(); it.hasNext();) {
            InterfaceIntroductionDefinition introDef = (InterfaceIntroductionDefinition)it.next();
            Expression expression = introDef.getExpression();
            if (expression.isOfType(PointcutType.CLASS) && expression.match(classMetaData, PointcutType.CLASS)) {
                interfaceIntroductionDefs.add(introDef);
            }
        }
        // add introduction definitions as well
        interfaceIntroductionDefs.addAll(getIntroductionDefinitions(classMetaData));
View Full Code Here

     */
    public boolean isInCflow() {
        if (m_checkCflow) {
            boolean isInCFlow = false;
            for (Iterator it = m_cflowExpressions.iterator(); it.hasNext();) {
                Expression cflowExpression = (Expression)it.next();
                if (m_system.isInControlFlowOf(cflowExpression)) {
                    isInCFlow = true;
                    break;
                }
            }
View Full Code Here

    public Object visit(Anonymous node, Object data) {
        String expr = node.name;
        if (expr.startsWith("cflow(")) {
            return new StringBuffer(expr);
        } else {
            Expression expression = null;
            ExpressionContext ctx = (ExpressionContext)data;
            ExpressionNamespace ns = ctx.getNamespace();
            if (expr.startsWith("execution(")) {
                expression = ns.createExecutionExpression(
                        expr.substring(10, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("call(")) {
                expression = ns.createCallExpression(
                        expr.substring(5, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("set(")) {
                expression = ns.createSetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("get(")) {
                expression = ns.createGetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("class(")) {
                expression = ns.createClassExpression(
                        expr.substring(6, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("handler(")) {
                expression = ns.createHandlerExpression(
                        expr.substring(8, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("attribute(")) {
                expression = ns.createAttributeExpression(
                        expr.substring(10, expr.length()-1),
                        ""
                );
            } else {
                throw new RuntimeException("unknown anonymous: "+expr);
            }
            if (expression.match(
                    ctx.getClassMetaData(), ctx.getMemberMetaData(), ctx.getExceptionType(), ctx.getPointcutType())) {
                return TRUE;
            } else {
                return FALSE;
            }
View Full Code Here

    }

    public Object visit(Identifier node, Object data) {
        ExpressionContext ctx = (ExpressionContext)data;
        String leafName = node.name;
        Expression expression = ctx.getNamespace().getExpression(leafName);
        if (expression != null) {
            if (PointcutType.isCflowTypeOnly(expression.getTypes())) {
                return Boolean.TRUE;//match at TF time
            } else {
                //TODO WITHIN
                return new Boolean(expression.match(ctx.getClassMetaData(),
                        ctx.getMemberMetaData(), ctx.getExceptionType(), ctx.getPointcutType())
                );
            }
        }
        else {
View Full Code Here

        String expr = node.name;

        if (expr.startsWith("cflow(")) {
            return Boolean.TRUE;
        } else {
            Expression expression = null;
            ExpressionNamespace ns = ctx.getNamespace();
            if (expr.startsWith("execution(")) {
                expression = ns.createExecutionExpression(
                        expr.substring(10, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("call(")) {
                expression = ns.createCallExpression(
                        expr.substring(5, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("set(")) {
                expression = ns.createSetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("get(")) {
                expression = ns.createGetExpression(
                        expr.substring(4, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("class(")) {
                expression = ns.createClassExpression(
                        expr.substring(6, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("handler(")) {
                expression = ns.createHandlerExpression(
                        expr.substring(8, expr.length()-1),
                        "",""
                );
            } else if (expr.startsWith("attribute(")) {
                expression = ns.createAttributeExpression(
                        expr.substring(10, expr.length()-1),
                        ""
                );
            } else {
                throw new RuntimeException("unknown anonymous: "+expr);
            }
            if (expression.match(
                    ctx.getClassMetaData(), ctx.getMemberMetaData(), ctx.getExceptionType(), ctx.getPointcutType())) {
                return Boolean.TRUE;
            } else {
                return Boolean.FALSE;
            }
View Full Code Here

    public Object visit(FalseNode node, Object data) {
        return FALSE;
    }

    public Object visit(Anonymous node, Object data) {
        Expression expression = null;
        ExpressionNamespace ns = (ExpressionNamespace)data;
        String expr = node.name;
        int hash = node.name.hashCode();
        String exprAutoName = null;
        if (hash >= 0) {
View Full Code Here

        return getLeftHS(node, data);
    }

    public Object visit(Identifier node, Object data) {
        ExpressionNamespace space = (ExpressionNamespace)data;
        Expression expression = space.getExpression(node.name);
        if (expression != null) {
            //((TypeVisitorContext)data).addTypes(expression.getType());
            //return expression.getType();
            //TODO AVO allow nested lookup of type ??
            Set set = new HashSet();
            set.addAll(expression.getTypes());
            return set;
        }
        else {
            throw new RuntimeException("No such registered expression: " + node.name);
        }
View Full Code Here

        if (!m_aspectsLoaded) throw new IllegalStateException("aspects are not loaded");
        if (classMetaData == null) throw new IllegalArgumentException("class meta-data can not be null");

        for (Iterator it = m_introductionMap.values().iterator(); it.hasNext();) {
            IntroductionDefinition introDef = (IntroductionDefinition)it.next();
            Expression expression = introDef.getExpression();
            if (expression.getType().equals(PointcutType.CLASS) && expression.match(classMetaData)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.definition.expression.Expression

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.