@Override
public List<? extends Statement> generateDecorator(InjectableInstance<Page> ctx) {
final List<Statement> stmts = new ArrayList<Statement>();
if (ctx.getInjector().getInjectedType().isAnnotationPresent(RestrictedAccess.class)) {
final RestrictedAccess annotation = ctx.getAnnotation(RestrictedAccess.class);
final String roleListenerVar = ctx.getInjector().getInstanceVarName() + "_roleListener";
ctx.getTargetInjector().addStatementToEndOfInjector(
Stmt.declareFinalVariable(
roleListenerVar,
MetaClassFactory.parameterizedAs(LifecycleListener.class,
MetaClassFactory.typeParametersOf(ctx.getInjector().getInjectedType())),
Stmt.newObject(PageRoleLifecycleListener.class,
(Object[]) annotation.roles())));
ctx.getTargetInjector().addStatementToEndOfInjector(
Stmt.loadVariable("context")
.invoke("addInitializationCallback",
Refs.get(ctx.getInjector().getInstanceVarName()),
createInitializationCallback(