Package org.aspectj.lang.reflect

Examples of org.aspectj.lang.reflect.MethodSignature


        assertSame(target, raw);

        assertSame(method.getName(), AbstractAspectJAdvice.currentJoinPoint().getSignature().getName());
        assertEquals(method.getModifiers(), AbstractAspectJAdvice.currentJoinPoint().getSignature().getModifiers());

        MethodSignature msig = (MethodSignature) AbstractAspectJAdvice.currentJoinPoint().getSignature();
        assertSame("Return same MethodSignature repeatedly", msig, AbstractAspectJAdvice.currentJoinPoint().getSignature());
        assertSame("Return same JoinPoint repeatedly", AbstractAspectJAdvice.currentJoinPoint(), AbstractAspectJAdvice.currentJoinPoint());
        assertEquals(method.getDeclaringClass(), msig.getDeclaringType());
        assertTrue(Arrays.equals(method.getParameterTypes(), msig.getParameterTypes()));
        assertEquals(method.getReturnType(), msig.getReturnType());
        assertTrue(Arrays.equals(method.getExceptionTypes(), msig.getExceptionTypes()));
        msig.toLongString();
        msig.toShortString();
      }
    });
    ITestBean itb = (ITestBean) pf.getProxy();
    // Any call will do
    assertEquals("Advice reentrantly set age", newAge, itb.getAge());
View Full Code Here


    private boolean isVoidReturnType(final ProceedingJoinPoint pjp) {
        boolean isVoidReturnType = false;
        final Signature signature = pjp.getStaticPart().getSignature();
        if (signature instanceof MethodSignature) {
            final MethodSignature methodSignature = (MethodSignature) signature;
            isVoidReturnType = (methodSignature != null) ? Void.TYPE.equals(methodSignature.getReturnType()) : false;
        }
        return isVoidReturnType;
    }
View Full Code Here

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Around("call(@com.amazonaws.services.simpleworkflow.flow.annotations.Asynchronous * *(..)) && @annotation(asynchronousAnnotation)")
    public Object makeAsynchronous(ProceedingJoinPoint pjp, Asynchronous asynchronousAnnotation) throws Throwable {
        final Signature signature = pjp.getStaticPart().getSignature();
        if (signature instanceof MethodSignature) {
            final MethodSignature methodSignature = (MethodSignature) signature;
            int i = 0;
            Object[] methodArguments = pjp.getArgs();
            Annotation[][] parameterAnnotations = methodSignature.getMethod().getParameterAnnotations();
            List<Promise> valueParams = new ArrayList<Promise>();
            for (final Class<?> parameterType : methodSignature.getParameterTypes()) {
                if ((isPromise(parameterType) || isPromiseArray(parameterType) || (isCollection(parameterType) && hasWaitAnnotation(parameterAnnotations[i])))
                        && !hasNoWaitAnnotation(parameterAnnotations[i])) {
                    Object param = methodArguments[i];
                    if (isPromise(parameterType)) {
                        valueParams.add((Promise) param);
View Full Code Here

  private DecoratorResult obterDecoratorResult(Object target, Signature signature) {
    DecoratorResult decoratorResult = null;
    try {
      if (target != null) {
        MethodSignature methodSig = (MethodSignature) signature;
        Method method = methodSig.getMethod();
        Method overrideMethod = target.getClass().getDeclaredMethod(method.getName(), method.getParameterTypes());
        if (overrideMethod != null && overrideMethod.isAnnotationPresent(DecoratorResult.class)) {
          decoratorResult = overrideMethod.getAnnotation(DecoratorResult.class);
        } else if (method.isAnnotationPresent(DecoratorResult.class)) {
          decoratorResult = method.getAnnotation(DecoratorResult.class);
View Full Code Here

     *         isn't sub-type of {@link MethodSignature}
     */
    public static Method getMethodFromTarget(JoinPoint joinPoint) {
        Method method = null;
        if (joinPoint.getSignature() instanceof MethodSignature) {
            MethodSignature signature = (MethodSignature) joinPoint.getSignature();
            method = getDeclaredMethod(joinPoint.getTarget().getClass(), signature.getName(),
                    getParameterTypes(joinPoint));
        }
        return method;
    }
View Full Code Here

     * @param joinPoint the join point
     * @return the parameter types for the method this object
     *         represents
     */
    public static Class[] getParameterTypes(JoinPoint joinPoint) {
        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
        Method method = signature.getMethod();
        return method.getParameterTypes();
    }
View Full Code Here

    }

    private Method getMethod(ProceedingJoinPoint pjp) {
        Signature signature = pjp.getSignature();
        if (signature instanceof MethodSignature) {
            MethodSignature mSignature = (MethodSignature) signature;
            Class targetClass = pjp.getTarget().getClass();
            try {
                return targetClass.getMethod(mSignature.getMethod().getName(), mSignature.getParameterTypes());
            } catch (NoSuchMethodException e) {
                return null;
            }
        } else {
            return null;
View Full Code Here

    String returnValueString = returnValue != null ? returnValue.toString() : "";
    final String fullyQualifiedMethodName = joinPoint.getSignature().getDeclaringType().getSimpleName() + "#"
        + joinPoint.getSignature().getName();
    if (joinPoint.getSignature() instanceof MethodSignature) {
      MethodSignature signature = (MethodSignature) joinPoint.getSignature();
      Class<?> returnType = signature.getReturnType();
      if (returnType.getName().compareTo("void") == 0) {
        returnValueString = "void";
      }
    }
View Full Code Here

    @Before("anyMethod() && withStepAnnotation()")
    public void stepStart(JoinPoint joinPoint) {
        String stepTitle = createTitle(joinPoint);

        MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
        StepStartedEvent startedEvent = new StepStartedEvent(
                getName(methodSignature.getName(), joinPoint.getArgs())
        );

        if (!stepTitle.isEmpty()) {
            startedEvent.setTitle(stepTitle);
        }
View Full Code Here

    public void stepStop(JoinPoint joinPoint, Object result) {
        Allure.LIFECYCLE.fire(new StepFinishedEvent());
    }

    public String createTitle(JoinPoint joinPoint) {
        MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
        Step step = methodSignature.getMethod().getAnnotation(Step.class);
        return step == null ? "" : getTitle(step.value(), methodSignature.getName(), joinPoint.getThis(), joinPoint.getArgs());
    }
View Full Code Here

TOP

Related Classes of org.aspectj.lang.reflect.MethodSignature

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.