}
Annotation annotation = m.getAnnotation(Service.class);
String svcName = ((Service) annotation).value().equals("") ? m.getName() : ((Service) annotation).value();
if (parmTypes.length == 1 && !Message.class.isAssignableFrom(parmTypes[0])) {
context.getBus().subscribe(svcName, new MethodEndpointCallback(inst, m));
}
else {
Class parmClass = parmTypes[0];
if (!parmClass.isAnnotationPresent(ExposeEntity.class)) {
log.warn("method service-endpoint accepts a type which is not exposed to the Errai serializer: "
+ m.getDeclaringClass().getName() + "#" + m.getName());
}
context.getBus().subscribe(svcName, new MethodEndpointDynamicParmCallback(inst, m, parms, parmTypes));
}
}
else {
int i = 0;
for (Annotation[] annotations : m.getParameterAnnotations()) {
Class parmType = parmTypes[i++];
for (Annotation annotation : annotations) {
if (annotation instanceof Service) {
if (!Message.class.isAssignableFrom(parmType))
throw new ErraiBootstrapFailure("attempt to declare service handler on illegal type: " + parmType.getName());
if (parmTypes.length != 1)
throw new ErraiBootstrapFailure("wrong number of method arguments for service endpoint: " + m.getName() + ": " + parmTypes.length);
String svcName = ((Service) annotation).value().equals("") ? m.getName() : ((Service) annotation).value();
context.getBus().subscribe(svcName, new MethodEndpointCallback(inst, m));
}
}
}
}
}