Package org.codehaus.aspectwerkz.pointcut

Examples of org.codehaus.aspectwerkz.pointcut.ThrowsPointcut


        if (classMetaData == null) throw new IllegalArgumentException("class meta-data can not be null");
        if (methodMetaData == null) throw new IllegalArgumentException("method meta-data can not be null");

        List pointcutList = new ArrayList();
        for (Iterator it = m_throwsPointcuts.values().iterator(); it.hasNext();) {
            final ThrowsPointcut pointcut = (ThrowsPointcut)it.next();
            if (pointcut.matches(classMetaData, methodMetaData)) {
                pointcutList.add(pointcut);
            }
        }
        return pointcutList;
    }
View Full Code Here


        if (classMetaData == null) throw new IllegalArgumentException("class meta-data can not be null");
        if (methodMetaData == null) throw new IllegalArgumentException("method meta-data can not be null");
        if (exception == null) throw new IllegalArgumentException("exception class name can not be null");

        for (Iterator it = m_throwsPointcuts.values().iterator(); it.hasNext();) {
            final ThrowsPointcut pointcut = (ThrowsPointcut)it.next();
            if (pointcut.matches(classMetaData, methodMetaData, exception)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

            // get all the throws pointcuts for this class
            List pointcuts = m_system.getThrowsPointcuts(m_classMetaData, m_methodMetaData);

            for (Iterator it = pointcuts.iterator(); it.hasNext();) {
                ThrowsPointcut throwsPointcut = (ThrowsPointcut)it.next();
                int[] advices = throwsPointcut.getAdviceIndexes();
                for (int j = 0; j < advices.length; j++) {
                    adviceIndexes.add(new Integer(advices[j]));
                }
            }
View Full Code Here

                List adviceWeavingRules = aspectDefinition.getAdviceWeavingRules();
                for (Iterator it2 = adviceWeavingRules.iterator(); it2.hasNext();) {
                    AdviceWeavingRule weavingRule = (AdviceWeavingRule)it2.next();

                    // create throws pointcut
                    ThrowsPointcut pointcut = new ThrowsPointcut(uuid, weavingRule.getExpression());

                    // add all referenced poincuts definitions
                    boolean hasThrowsPointcut = false;
                    List pointcutRefs = weavingRule.getPointcutRefs();
                    for (Iterator it3 = pointcutRefs.iterator(); it3.hasNext();) {
                        PointcutDefinition pointcutDefinition =
                                aspectDefinition.getPointcutDef((String)it3.next());
                        if (pointcutDefinition != null && pointcutDefinition.getType().
                                equalsIgnoreCase(PointcutDefinition.THROWS)) {
                            pointcut.addPointcutDef(pointcutDefinition);
                            hasThrowsPointcut = true;
                        }
                    }

                    // check if the weaving rule had a throws pointcut, if not continue
                    if (!hasThrowsPointcut) {
                        continue;
                    }

                    // add advices
                    List adviceRefs = weavingRule.getAdviceRefs();
                    for (Iterator it3 = adviceRefs.iterator(); it3.hasNext();) {
                        String asdf = (String)it3.next();
                        pointcut.addAdvice(asdf);
                    }

                    // add advices from advice stacks
                    List adviceStackRefs = weavingRule.getAdviceStackRefs();
                    for (Iterator it3 = adviceStackRefs.iterator(); it3.hasNext();) {
                        AdviceStackDefinition adviceStackDefinition =
                                definition.getAdviceStackDefinition((String)it3.next());

                        List advices = adviceStackDefinition.getAdviceRefs();
                        for (Iterator it4 = advices.iterator(); it4.hasNext();) {
                            pointcut.addAdvice((String)it4.next());
                        }
                    }

                    // add the throws pointcut
                    aspect.addThrowsPointcut(pointcut);
View Full Code Here

                    // create throws pointcut
                    Expression expression = bindAdviceRule.getExpression();
                    if (!expression.getType().equals(PointcutType.THROWS)) {
                        continue;
                    }
                    ThrowsPointcut pointcut = new ThrowsPointcut(uuid, expression);

                    // add advices
                    List adviceRefs = bindAdviceRule.getAdviceRefs();
                    for (Iterator it3 = adviceRefs.iterator(); it3.hasNext();) {
                        String asdf = (String)it3.next();
                        pointcut.addAdvice(asdf);
                    }

                    // add advices from advice stacks
                    List adviceStackRefs = bindAdviceRule.getAdviceStackRefs();
                    for (Iterator it3 = adviceStackRefs.iterator(); it3.hasNext();) {
                        AdviceStackDefinition adviceStackDefinition =
                                definition.getAdviceStackDefinition((String)it3.next());

                        List advices = adviceStackDefinition.getAdviceRefs();
                        for (Iterator it4 = advices.iterator(); it4.hasNext();) {
                            pointcut.addAdvice((String)it4.next());
                        }
                    }

                    // add the throws pointcut
                    aspect.addThrowsPointcut(pointcut);
View Full Code Here

     * @param expression the expression
     * @return the method pointcut
     */
    public ThrowsPointcut getThrowsPointcut(final String expression) {
        for (Iterator it = m_throwsPointcuts.iterator(); it.hasNext();) {
            ThrowsPointcut pointcut = (ThrowsPointcut)it.next();
            if (pointcut.getExpression().getExpression().equals(expression)) {
                return pointcut;
            }
        }
        return null;
    }
View Full Code Here

        if (classMetaData == null) throw new IllegalArgumentException("class meta-data can not be null");
        if (methodMetaData == null) throw new IllegalArgumentException("method meta-data can not be null");

        List pointcutList = new ArrayList();
        for (Iterator it = m_throwsPointcuts.iterator(); it.hasNext();) {
            final ThrowsPointcut pointcut = (ThrowsPointcut)it.next();
            if (pointcut.getExpression().match(classMetaData, methodMetaData)) {
                pointcutList.add(pointcut);
            }
        }
        return pointcutList;
    }
View Full Code Here

        if (classMetaData == null) throw new IllegalArgumentException("class meta-data can not be null");
        if (methodMetaData == null) throw new IllegalArgumentException("method meta-data can not be null");
        if (exception == null) throw new IllegalArgumentException("exception class name can not be null");

        for (Iterator it = m_throwsPointcuts.iterator(); it.hasNext();) {
            final ThrowsPointcut pointcut = (ThrowsPointcut)it.next();
            if (pointcut.getExpression().match(classMetaData, methodMetaData, exception)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

            List aroundAdvices = aspectDef.getAroundAdvices();
            for (Iterator it2 = aroundAdvices.iterator(); it2.hasNext();) {
                AdviceDefinition adviceDef = (AdviceDefinition)it2.next();

                if (adviceDef.getExpression().getType().equals(PointcutType.THROWS)) {
                    ThrowsPointcut pointcut = aspectMetaData.getThrowsPointcut(
                            adviceDef.getExpression().getExpression()
                    );
                    if (pointcut == null) {
                        pointcut = new ThrowsPointcut(uuid, adviceDef.getExpression());
                        aspectMetaData.addThrowsPointcut(pointcut);
                    }
                    pointcut.addAdvice(adviceDef.getName());
                }
            }
        }
    }
View Full Code Here

            // get all the throws pointcuts for this class
            List pointcuts = m_system.getThrowsPointcuts(m_classMetaData, m_methodMetaData);

            for (Iterator it = pointcuts.iterator(); it.hasNext();) {
                ThrowsPointcut throwsPointcut = (ThrowsPointcut)it.next();
                IndexTuple[] indexes = throwsPointcut.getAdviceIndexes();
                for (int j = 0; j < indexes.length; j++) {
                    adviceIndexes.add(indexes[j]);
                }
            }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.pointcut.ThrowsPointcut

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.