Package org.aspectj.lang

Examples of org.aspectj.lang.Signature


    public void setDefaultKeyProvider(KeyProvider defaultKeyProvider) {
        this.defaultKeyProvider = defaultKeyProvider;
    }

    protected Method getMethodToCache(final JoinPoint jp) throws NoSuchMethodException {
    final Signature sig = jp.getSignature();
    if (!(sig instanceof MethodSignature)) {
      throw new InvalidAnnotationException("This annotation is only valid on a method.");
    }
    final MethodSignature msig = (MethodSignature) sig;
    final Object target = jp.getTarget();
View Full Code Here


        interceptor.setAccessDecisionManager(adm);
        interceptor.setAuthenticationManager(authman);
        interceptor.setSecurityMetadataSource(mds);
        // Set up joinpoint information for the countLength method on TargetObject
        joinPoint = mock(ProceedingJoinPoint.class); //new MockJoinPoint(new TargetObject(), method);
        Signature sig = mock(Signature.class);
        when(sig.getDeclaringType()).thenReturn(TargetObject.class);
        JoinPoint.StaticPart staticPart = mock(JoinPoint.StaticPart.class);
        when(joinPoint.getSignature()).thenReturn(sig);
        when(joinPoint.getStaticPart()).thenReturn(staticPart);
        CodeSignature codeSig = mock(CodeSignature.class);
        when(codeSig.getName()).thenReturn("countLength");
View Full Code Here

  public JoinPoint.EnclosingStaticPart makeESJP(String kind, Signature sig, int l) {
    return new JoinPointImpl.EnclosingStaticPartImpl(count++, kind, sig, makeSourceLoc(l, -1));
  }

  public static JoinPoint.StaticPart makeEncSJP(Member member) {
    Signature sig = null;
    String kind = null;
    if (member instanceof Method) {
      Method method = (Method) member;
      sig = new MethodSignatureImpl(method.getModifiers(), method.getName(), method.getDeclaringClass(), method
          .getParameterTypes(), new String[method.getParameterTypes().length], method.getExceptionTypes(), method
View Full Code Here

        return result;
    }

    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

public class AsynchronousAspect {

    @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();
View Full Code Here

        String attrValue = StringFormatterUtils.formatObject(returnValue);
        op.put(MODEL_ATTR_VALUE, attrValue);
    }

    static String extractModelAttributeName(JoinPoint jp) {
        Signature sig = jp.getSignature();
        Method method = (sig instanceof MethodSignature) ? ((MethodSignature) sig).getMethod() : null;
        ModelAttribute ma = (method == null) ? null : method.getAnnotation(ModelAttribute.class);
        String modelAttrName = (ma == null) ? null : ma.value();
        if (!StringUtil.isEmpty(modelAttrName)) {
            return modelAttrName;
View Full Code Here

    @SuppressWarnings("boxing")
    @Test
    public void testView() throws Exception {
        JoinPoint jp = mock(JoinPoint.class);
        Signature sig = mock(Signature.class);
        when(jp.getSignature()).thenReturn(sig);
        when(sig.getName()).thenReturn("GreatHeapingMethod");
        when(jp.getArgs()).thenReturn(new String[]{"one", "two"});
        JoinPoint.StaticPart staticPart = mock(JoinPoint.StaticPart.class);
        SourceLocation sl = mock(SourceLocation.class);
        when(sl.getFileName()).thenReturn("Test.java");
        when(sl.getLine()).thenReturn(100);
View Full Code Here

    public void check( JoinPoint jp ) {
        /* this might get some authentication/authorization info from the request
         * and throw a WebApplicationException with a response with status 401 (unauthorized)
         * if the request is not authorized.
         */
        final Signature signature = jp.getSignature();
        LOGGER.info( "Authorized execution of " + signature.getDeclaringTypeName() + "." + signature.getName() );
    }
View Full Code Here

        return result;
    }

    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

public class AsynchronousAspect {

    @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();
View Full Code Here

TOP

Related Classes of org.aspectj.lang.Signature

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.