in src/main/java/com/amazonaws/eclipse/simpleworkflow/asynchrony/annotationprocessor/WorkflowValidator.java [64:116]
public Boolean visitExecutable(ExecutableElement e, ProcessingEnvironment p) {
int annotationCount = 0;
if (e.getAnnotation(Execute.class) != null) {
if (hasExecute) {
reportError(p, "Only one method allowed with @Execute annotation.", e);
} else {
hasExecute = true;
}
annotationCount++;
TypeMirror returnType = e.getReturnType();
if (!(ProcessorUtils.isVoidType(returnType) || ProcessorUtils.isPromiseType(returnType))) {
reportError(p, "Method with @Execute annotations is only allowed to have void or Promise as return types.", e);
}
}
if (e.getAnnotation(Signal.class) != null) {
if (!ProcessorUtils.isVoidType(e.getReturnType())) {
reportError(p, "Signal method cannot have a return type.", e);
}
annotationCount++;
}
if (e.getAnnotation(GetState.class) != null) {
if (hasGetState) {
reportError(p, "Only one method allowed with @GetState annotation.", e);
}
else {
hasGetState = true;
}
TypeMirror returnType = e.getReturnType();
if (ProcessorUtils.isVoidType(returnType)) {
reportError(p, "GetState method cannot have void as return type.", e);
} else if (ProcessorUtils.isPromiseType(returnType)) {
reportError(p, "GetState method cannot have Promise as return type.", e);
}
annotationCount++;
}
if (annotationCount > 1) {
reportError(p, "Annotations @Execute, @Signal and @GetState are exclusive.", e);
}
for (VariableElement parameter: e.getParameters()) {
TypeMirror parameterType = parameter.asType();
if (ProcessorUtils.isPromiseType(parameterType)) {
reportError(p, "@Workflow methods are not allowed to have Promise parameter types.", parameter);
}
}
return super.visitExecutable(e, p);
}