@Override
public List<? extends Statement> generateDecorator(final InjectableInstance<ShadowService> ctx) {
ctx.ensureMemberExposed(PrivateAccessType.Read);
final ShadowService shadowService = ctx.getAnnotation();
String serviceName = null;
Statement subscribeShadowStatement = null;
final Class<?> javaClass = ctx.getElementType().asClass();
for (final Class<?> intf : javaClass.getInterfaces()) {
if (intf.isAnnotationPresent(Remote.class)) {
serviceName = intf.getName() + ":RPC";
final AnonymousClassStructureBuilder builder = generateMethodDelegates(ctx, intf);
subscribeShadowStatement = Stmt.castTo(ClientMessageBus.class,
Stmt.invokeStatic(ErraiBus.class, "get")).invoke("subscribeShadow", serviceName, builder.finish());
}
}
if (serviceName == null) {
if (shadowService.value().equals("")) {
serviceName = ctx.getMemberName();
} else {
serviceName = shadowService.value();
}
subscribeShadowStatement = Stmt.castTo(ClientMessageBus.class,
Stmt.invokeStatic(ErraiBus.class, "get")).invoke("subscribeShadow", serviceName, ctx.getValueStatement());
}