private Class<? extends ResourceGenerator> findResourceGenerator(
TreeLogger logger, JMethod method) throws UnableToCompleteException {
JClassType resourceType = method.getReturnType().isClassOrInterface();
assert resourceType != null;
ResourceGeneratorType annotation = resourceType.findAnnotationInTypeHierarchy(ResourceGeneratorType.class);
if (annotation == null) {
logger.log(TreeLogger.ERROR, "No @"
+ ResourceGeneratorType.class.getName() + " was specifed for type "
+ resourceType.getQualifiedSourceName() + " or its supertypes");
throw new UnableToCompleteException();