Package org.codehaus.aspectwerkz.attribdef.definition

Examples of org.codehaus.aspectwerkz.attribdef.definition.AdviceDefinition


                                java.lang.System.arraycopy(tmpAspects, 0, m_aspects, 0, tmpAspects.length);

                                // retrieve a sorted advices list => matches the sorted method list in the container
                                List advices = aspect.___AW_getAspectDef().getAllAdvices();
                                for (Iterator it = advices.iterator(); it.hasNext();) {
                                    final AdviceDefinition adviceDef = (AdviceDefinition)it.next();
                                    m_adviceIndexes.put(
                                            adviceDef.getName(),
                                            new IndexTuple(indexAspect, adviceDef.getMethodIndex())
                                    );
                                }

                                List introductions = aspect.___AW_getAspectDef().getIntroductions();
                                for (Iterator it = introductions.iterator(); it.hasNext(); ) {
View Full Code Here


            AspectMetaData aspectMetaData = SystemLoader.getSystem(uuid).
                    getAspectMetaData(aspectDef.getName());

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

                CallPointcut pointcut = aspectMetaData.getCallPointcut(
                        adviceDef.getExpression().getExpression()
                );
                if (pointcut == null) {
                    pointcut = new CallPointcut(uuid, adviceDef.getExpression());
                    aspectMetaData.addCallPointcut(pointcut);
                }
                pointcut.addBeforeAdvice(adviceDef.getName());
            }

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

                CallPointcut pointcut = aspectMetaData.getCallPointcut(
                        adviceDef.getExpression().getExpression()
                );
                if (pointcut == null) {
                    pointcut = new CallPointcut(uuid, adviceDef.getExpression());
                    aspectMetaData.addCallPointcut(pointcut);
                }
                pointcut.addAfterAdvice(adviceDef.getName());
            }
        }
    }
View Full Code Here

            AspectMetaData aspectMetaData = SystemLoader.getSystem(uuid).getAspectMetaData(aspectDef.getName());

            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

                                java.lang.System.arraycopy(tmpAspects, 0, m_aspects, 0, tmpAspects.length);

                                // retrieve a sorted advices list => matches the sorted method list in the container
                                List advices = aspect.___AW_getAspectDef().getAllAdvices();
                                for (Iterator it = advices.iterator(); it.hasNext();) {
                                    final AdviceDefinition adviceDef = (AdviceDefinition)it.next();
                                    m_adviceIndexes.put(
                                            adviceDef.getName(),
                                            new IndexTuple(indexAspect, adviceDef.getMethodIndex())
                                    );
                                }

                                List introductions = aspect.___AW_getAspectDef().getIntroductions();
                                for (Iterator it = introductions.iterator(); it.hasNext(); ) {
View Full Code Here

            AspectMetaData aspectMetaData = SystemLoader.getSystem(uuid).getAspectMetaData(aspectDef.getName());

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

                ExecutionPointcut pointcut = aspectMetaData.getExecutionPointcut(
                        adviceDef.getExpression().getExpression()
                );
                if (pointcut == null) {
                    pointcut = new ExecutionPointcut(uuid, adviceDef.getExpression());
                    aspectMetaData.addExecutionPointcut(pointcut);
                }
                pointcut.addAdvice(adviceDef.getName());

                // TODO: how to handle cflow?
//                    methodPointcut.setCFlowExpression(adviceDef.getExpression().getCFlowExpression());
            }
        }
View Full Code Here

     */
    public static List sortAdvices(final List advices) {
        Collections.sort(advices, new Comparator() {
            private Comparator m_comparator = MethodComparator.getInstance(MethodComparator.NORMAL_METHOD);
            public int compare(final Object obj1, final Object obj2) {
                AdviceDefinition advice1 = (AdviceDefinition)obj1;
                AdviceDefinition advice2 = (AdviceDefinition)obj2;
                return m_comparator.compare(advice1.getMethod(), advice2.getMethod());
            }
        });
        return advices;
    }
View Full Code Here

     */
    public AdviceDefinition getAdviceDefinition(final String name) {
        if (!m_aspectsLoaded) throw new IllegalStateException("aspects are not loaded");
        Collection adviceDefs = getAdviceDefinitions();
        for (Iterator it = adviceDefs.iterator(); it.hasNext();) {
            AdviceDefinition adviceDef = (AdviceDefinition)it.next();
            if (adviceDef.getName().equals(name)) {
                return adviceDef;
            }
        }
        return null;
    }
View Full Code Here

     * @return boolean
     */
    public boolean hasAdvice(final String name) {
        Collection adviceDefs = getAdviceDefinitions();
        for (Iterator it = adviceDefs.iterator(); it.hasNext();) {
            AdviceDefinition adviceDef = (AdviceDefinition)it.next();
            if (adviceDef.getName().equals(name)) {
                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.getType().equals(PointcutType.EXECUTION)
                        && expression.match(classMetaData)) {
                    return true;
                }
            }
View Full Code Here

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

        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.getType().equals(PointcutType.EXECUTION)
                        && expression.match(classMetaData, methodMetaData)) {
                    return true;
                }
            }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.attribdef.definition.AdviceDefinition

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.