List of usage examples for org.aspectj.lang.reflect CodeSignature getParameterTypes
Class[] getParameterTypes();
From source file:jp.go.nict.langrid.commons.validator.annotation.aspect.AspectParameterValidationExecutor.java
License:Open Source License
/** * //from ww w.ja v a 2 s . c o m * */ public static void execute(JoinPoint joinPoint) throws ParameterValidationException, ValidationProcessException { CodeSignature sig = (CodeSignature) joinPoint.getSignature(); Class<?>[] types = sig.getParameterTypes(); String[] names = sig.getParameterNames(); Object[] args = joinPoint.getArgs(); Method method = null; try { method = joinPoint.getThis().getClass().getDeclaredMethod(sig.getName(), types); } catch (NoSuchMethodException e) { throw new ValidationProcessException(e); } AnnotationParameterValidationExecutor.execute(method, names, args); }
From source file:org.iterx.miru.support.aspectj.aop.ConstructorInvocationImpl.java
License:Open Source License
public AccessibleObject getStaticPart() { try {/*from ww w . ja v a 2 s. co m*/ CodeSignature signature; Class cls; signature = (CodeSignature) joinPoint.getSignature(); cls = signature.getDeclaringType(); return cls.getConstructor(signature.getParameterTypes()); } catch (NoSuchMethodException e) { throw new UnsupportedOperationException(e); } }
From source file:org.iterx.miru.support.aspectj.aop.MethodInvocationImpl.java
License:Open Source License
public AccessibleObject getStaticPart() { try {// w w w . ja va 2s .com CodeSignature signature; Class cls; signature = (CodeSignature) joinPoint.getSignature(); cls = signature.getDeclaringType(); return cls.getMethod(signature.getName(), signature.getParameterTypes()); } catch (NoSuchMethodException e) { throw new UnsupportedOperationException(e); } }
From source file:org.springframework.security.access.intercept.aspectj.AspectJMethodSecurityInterceptorTests.java
License:Apache License
@Before public final void setUp() throws Exception { MockitoAnnotations.initMocks(this); SecurityContextHolder.clearContext(); token = new TestingAuthenticationToken("Test", "Password"); interceptor = new AspectJMethodSecurityInterceptor(); 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"); when(codeSig.getDeclaringType()).thenReturn(TargetObject.class); when(codeSig.getParameterTypes()).thenReturn(new Class[] { String.class }); when(staticPart.getSignature()).thenReturn(codeSig); when(mds.getAttributes(any(JoinPoint.class))).thenReturn(SecurityConfig.createList("ROLE_USER")); when(authman.authenticate(token)).thenReturn(token); }