* available to the compiler.
*/
return null;
}
ExecutableElement domainMethod;
if (currentTypeIsProxy && isSetter(clientMethodElement, state)) {
// Look for void setFoo(...)
domainMethod =
new MethodFinder(name, state.types.getNoType(TypeKind.VOID), lookFor, false, state).scan(
domainElement, state);
if (domainMethod == null) {
// Try a builder style
domainMethod =
new MethodFinder(name, domainElement.asType(), lookFor, false, state).scan(
domainElement, state);
}
} else {
/*
* The usual case for getters and all service methods. Only box return
* types when matching context methods since there's a significant
* semantic difference between a null Integer and 0.
*/
domainMethod =
new MethodFinder(name, returnType, lookFor, !currentTypeIsProxy, state).scan(
domainElement, state);
}
if (domainMethod == null) {
// Did not find a service method
StringBuilder sb = new StringBuilder();
sb.append(returnType).append(" ").append(name).append("(");
for (TypeMirror param : lookFor) {
sb.append(param);
}
sb.append(")");
state.poison(clientMethodElement, Messages.domainMissingMethod(sb));
return null;
}
// Check if the method is public
if (!domainMethod.getModifiers().contains(Modifier.PUBLIC)) {
state.poison(clientMethodElement, Messages.domainMethodNotPublic(
domainMethod.getSimpleName()));
}
/*
* Check the domain method for any requirements for it to be static.
* InstanceRequests assume instance methods on the domain type.
*/
boolean isInstanceRequest =
state.types.isSubtype(clientMethod.getReturnType(), state.instanceRequestType);
if ((isInstanceRequest || requireInstanceDomainMethods)
&& domainMethod.getModifiers().contains(Modifier.STATIC)) {
state.poison(clientMethodElement, Messages.domainMethodWrongModifier(false, domainMethod
.getSimpleName()));
}
if (!isInstanceRequest && requireStaticDomainMethods
&& !domainMethod.getModifiers().contains(Modifier.STATIC)) {
state.poison(clientMethodElement, Messages.domainMethodWrongModifier(true, domainMethod
.getSimpleName()));
}
// Record the mapping
state.addMapping(clientMethodElement, domainMethod);