mirror of
https://github.com/zaaarf/route-cartographer.git
synced 2024-12-05 00:24:53 +01:00
fix: optional get default
This commit is contained in:
parent
9fc99e23d8
commit
145040c2c6
1 changed files with 4 additions and 5 deletions
|
@ -61,7 +61,6 @@ public class RouteCompass extends AbstractProcessor {
|
||||||
* @return false, letting other processor process the annotations again
|
* @return false, letting other processor process the annotations again
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
|
||||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
|
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
|
||||||
for(TypeElement annotationType : annotations) {
|
for(TypeElement annotationType : annotations) {
|
||||||
env.getElementsAnnotatedWith(annotationType)
|
env.getElementsAnnotatedWith(annotationType)
|
||||||
|
@ -80,7 +79,7 @@ public class RouteCompass extends AbstractProcessor {
|
||||||
this.getDTO(this.processingEnv.getTypeUtils().asElement(elem.getReturnType())),
|
this.getDTO(this.processingEnv.getTypeUtils().asElement(elem.getReturnType())),
|
||||||
this.getDTO(elem.getParameters().stream()
|
this.getDTO(elem.getParameters().stream()
|
||||||
.filter(e -> e.getAnnotation(RequestBody.class) != null)
|
.filter(e -> e.getAnnotation(RequestBody.class) != null)
|
||||||
.findFirst().get()),
|
.findFirst().orElse(null)),
|
||||||
this.getQueryParams(elem.getParameters())
|
this.getQueryParams(elem.getParameters())
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
@ -100,10 +99,10 @@ public class RouteCompass extends AbstractProcessor {
|
||||||
out.print("\t- ");
|
out.print("\t- ");
|
||||||
if(r.deprecated) out.print("[DEPRECATED] ");
|
if(r.deprecated) out.print("[DEPRECATED] ");
|
||||||
out.print(r.method + " " + r.path);
|
out.print(r.method + " " + r.path);
|
||||||
if(r.consumes != null) {
|
if(r.consumes != null && r.consumes.length > 0)
|
||||||
out.print("(expects: " + Arrays.toString(r.consumes) + ")");
|
out.print("(expects: " + Arrays.toString(r.consumes) + ")");
|
||||||
}
|
if(r.produces != null && r.produces.length > 0)
|
||||||
if(r.produces != null) out.print("(returns: " + Arrays.toString(r.produces) + ")");
|
out.print("(returns: " + Arrays.toString(r.produces) + ")");
|
||||||
out.println();
|
out.println();
|
||||||
|
|
||||||
BiConsumer<String, Route.Param[]> printParam = (name, params) -> {
|
BiConsumer<String, Route.Param[]> printParam = (name, params) -> {
|
||||||
|
|
Loading…
Reference in a new issue