}
private void transformMethod(final PlasticClass plasticClass, final PlasticMethod method) {
final PlasticField tokenFieldInstance = plasticClass.introduceField(InterceptorStatusToken.class,"_$token");
final FieldHandle tokenFieldHandle = tokenFieldInstance.getHandle();
// Attribute definition
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);
invocation.proceed();
InterceptorStatusToken tokenFieldValue = (InterceptorStatusToken) tokenFieldHandle.get(invocation.getInstance());
secChecker.checkAfter(tokenFieldValue, null);
}
};
method.addAdvice(securedMethodAdvice);