name = new ClosureName(annotation.value());
}
final boolean isStatic = method.getModifiers().contains(Modifier.STATIC);
final Name parameterType;
if (isStatic) {
final VariableElement firstParameter = method.getParameters().get(0);
parameterType = new Name(firstParameter.asType().toString());
} else {
parameterType = new Name(typeElement.getQualifiedName().toString());
}
final Closure closure;
if (method.getReturnType().getKind() == TypeKind.BOOLEAN) {
closure = new Closure(name, delegate, parameterType, isStatic, annotation.nullsafe());
} else {
final Name returnType = new Name(method.getReturnType().toString());
closure = new Closure(name, delegate, parameterType, returnType, isStatic, annotation.nullsafe());
}
final Type type = storage.apply(typeElement);
Preconditions.checkNotNull(type, "No type found for %s", typeElement);