From 14d5da23357ae6997be90a61b52681de333ddc53 Mon Sep 17 00:00:00 2001 From: Josiah Noel <32279667+SentryMan@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:55:16 -0400 Subject: [PATCH] change generated formatting --- .../http/generator/client/AnnotationUtil.java | 6 +++++- .../generator/client/ClientMethodWriter.java | 16 +++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/http-generator-client/src/main/java/io/avaje/http/generator/client/AnnotationUtil.java b/http-generator-client/src/main/java/io/avaje/http/generator/client/AnnotationUtil.java index aeb31c6b..0445e420 100644 --- a/http-generator-client/src/main/java/io/avaje/http/generator/client/AnnotationUtil.java +++ b/http-generator-client/src/main/java/io/avaje/http/generator/client/AnnotationUtil.java @@ -14,13 +14,17 @@ final class AnnotationUtil { private AnnotationUtil() {} public static void writeAnnotations(Append writer, Element element) { + writeAnnotations(writer, element, ""); + } + + public static void writeAnnotations(Append writer, Element element, String indent) { for (final AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { final var type = UType.parse(annotationMirror.getAnnotationType().asElement().asType()); if (type.mainType().startsWith("io.avaje.http") || type.mainType().startsWith("io.swagger")) { continue; } final String annotationName = annotationMirror.getAnnotationType().toString(); - final StringBuilder sb = new StringBuilder(" @").append(annotationName).append("("); + final StringBuilder sb = new StringBuilder(indent).append("@").append(annotationName).append("("); boolean first = true; for (final var entry : annotationMirror.getElementValues().entrySet()) { diff --git a/http-generator-client/src/main/java/io/avaje/http/generator/client/ClientMethodWriter.java b/http-generator-client/src/main/java/io/avaje/http/generator/client/ClientMethodWriter.java index 35e60967..32b6cc49 100644 --- a/http-generator-client/src/main/java/io/avaje/http/generator/client/ClientMethodWriter.java +++ b/http-generator-client/src/main/java/io/avaje/http/generator/client/ClientMethodWriter.java @@ -72,15 +72,17 @@ private void methodStart(Append writer) { } method.checkArgumentNames(); - segmentPropertyMap.forEach((k, v) -> { - writer.append(" private static final String %s = ", v); - final String getProperty = useConfig ? "Config.get(" : "System.getProperty("; - writer.append(getProperty).append("\"%s\");", k).eol(); - }); - writer.append(" // %s %s", webMethod, method.webMethodPath()).eol(); + + segmentPropertyMap.forEach( + (k, v) -> { + writer.append(" private static final String %s = ", v); + final String getProperty = useConfig ? "Config.get(" : "System.getProperty("; + writer.append(getProperty).append("\"%s\");", k).eol(); + }); + writer.append(" @Override").eol(); - AnnotationUtil.writeAnnotations(writer, method.element()); + AnnotationUtil.writeAnnotations(writer, method.element()," "); writer.append(" public %s%s %s(", methodGenericParams, returnType.shortType(), method.simpleName()); int count = 0; List params = method.params();