Examples of MethodAdvice


Examples of org.apache.tapestry5.ioc.MethodAdvice

        this.exceptionTracker = exceptionTracker;
    }

    public <T> T build(Class<T> serviceInterface, T delegate, String serviceId, final Logger logger)
    {
        MethodAdvice advice = new LoggingAdvice(logger, exceptionTracker);

        return aspectDecorator.build(serviceInterface, delegate, advice,
                                     String.format("<Logging interceptor for %s(%s)>", serviceId,
                                                   serviceInterface.getName()));
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.MethodAdvice

    @Test
    public void some_methods_not_intercepted() throws Exception
    {
        Subject delegate = mockSubject();

        MethodAdvice advice = new MethodAdvice()
        {
            public void advise(Invocation invocation)
            {
                assertEquals(invocation.getMethodName(), "advised");
View Full Code Here

Examples of org.apache.tapestry5.ioc.MethodAdvice

    @Test
    public void method_not_in_service_interface() throws Exception
    {
        Subject delegate = mockSubject();

        MethodAdvice advice = mockAdvice();

        replay();

        AspectInterceptorBuilder<Subject> builder = decorator.createBuilder(Subject.class, delegate, "<Subject>");
View Full Code Here

Examples of org.apache.tapestry5.ioc.MethodAdvice

    @Test
    public void method_with_duplicate_advice() throws Exception
    {
        Subject delegate = mockSubject();

        MethodAdvice advice = mockAdvice();

        replay();

        AspectInterceptorBuilder<Subject> builder = decorator.createBuilder(Subject.class, delegate, "<Subject>");
View Full Code Here

Examples of org.apache.tapestry5.ioc.MethodAdvice

    @Test
    public void arrays_as_parameters_and_result()
    {
        ArraysSubject delegate = new ArraysSubjectImpl();

        MethodAdvice advice = new MethodAdvice()
        {
            public void advise(Invocation invocation)
            {
                String[] param = (String[]) invocation.getParameter(0);
View Full Code Here

Examples of org.apache.tapestry5.ioc.MethodAdvice

    @Test
    public void some_methods_not_intercepted() throws Exception
    {
        Subject delegate = mockSubject();

        MethodAdvice advice = new MethodAdvice()
        {
            public void advise(Invocation invocation)
            {
                assertEquals(invocation.getMethodName(), "advised");
View Full Code Here

Examples of org.apache.tapestry5.plastic.MethodAdvice

        final ConfigAttributeHolder confAttrHolder = createConfigAttributeDefinitionField(plasticClass, annotation);
       
        PlasticMethod beginRenderMethod = plasticClass.introduceMethod(TransformConstants.BEGIN_RENDER_DESCRIPTION);

        final SecurityChecker secChecker = this.securityChecker;
        MethodAdvice beginRenderAdvice = new MethodAdvice() {
         
          public void advise(MethodInvocation invocation) {
           
            invocation.proceed();
                final InterceptorStatusToken statusTokenVal = secChecker.checkBefore(confAttrHolder);
                final ComponentResources componentResources = invocation.getInstanceContext().get(ComponentResources.class);
            componentResources.storeRenderVariable(STATUS_TOKEN, statusTokenVal);           
            }
        };

        beginRenderMethod.addAdvice(beginRenderAdvice);

        // ---------------- END TRANSFORMATION ------------------------


        PlasticMethod cleanupRenderMethod = plasticClass.introduceMethod(TransformConstants.CLEANUP_RENDER_DESCRIPTION);

        MethodAdvice cleanupRenderAdvice = new MethodAdvice() {
         
          public void advise(MethodInvocation invocation) {
              invocation.proceed();

              final ComponentResources componentResources = invocation.getInstanceContext().get(ComponentResources.class);
View Full Code Here

Examples of org.apache.tapestry5.plastic.MethodAdvice

        final Secured annotation = method.getAnnotation(Secured.class);
        //final String configField = createConfigAttributeDefinitionField(transformation, annotation);
        final ConfigAttributeHolder confAttrHolder = createConfigAttributeDefinitionField(plasticClass, annotation);

        final SecurityChecker secChecker = this.securityChecker;
        MethodAdvice securedMethodAdvice = new MethodAdvice() {
         
          public void advise(MethodInvocation invocation) {
           
              InterceptorStatusToken statusTokenVal = secChecker.checkBefore(confAttrHolder);
              tokenFieldHandle.set(invocation.getInstance(), statusTokenVal);
View Full Code Here

Examples of org.apache.tapestry5.plastic.MethodAdvice

        {
            if (m.getAnnotation(CommitAfter.class) != null)
            {
                PersistenceContext annotation = receiver.getMethodAnnotation(m, PersistenceContext.class);

                MethodAdvice advice =
                        annotation == null ? shared : new CommitAfterMethodAdvice(manager, annotation);

                receiver.adviseMethod(m, advice);
            }
        }
View Full Code Here

Examples of org.apache.tapestry5.plastic.MethodAdvice

        for (final PlasticMethod method : plasticClass
                .getMethodsWithAnnotation(CommitAfter.class))
        {
            PersistenceContext annotation = method.getAnnotation(PersistenceContext.class);

            MethodAdvice advice = annotation == null ? shared : new CommitAfterMethodAdvice(manager, annotation);

            method.addAdvice(advice);
        }
    }
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.