Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void testGeneration() throws Exception {

final CompilationTask task =
compiler.getTask(
new PrintWriter(System.out), null, null, Arrays.asList("--release=11"), null, files);
new PrintWriter(System.out), null, null, List.of("--release=" + Integer.getInteger("java.specification.version")), null, files);
task.setProcessors(Arrays.asList(new ClientProcessor()));

assertThat(task.call()).isTrue();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package io.avaje.http.generator.client.clients;

import io.avaje.http.api.BeanParam;
import io.avaje.http.api.Client;
import io.avaje.http.api.Patch;
import io.avaje.http.api.Post;

@Client
public interface ExampleClient2 extends ExampleClient {
@Patch
void patchy2();

@Post
void beanParam(@BeanParam Params s);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package io.avaje.http.generator.client.clients;

import io.avaje.http.api.Cookie;
import io.avaje.http.api.Header;
import io.avaje.http.api.QueryParam;

public class Params {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not add anything to the test coverage?

We have @BeanParams in tests/test-client-generation in JunkApi and CommonParams and if we needed more coverage we would add it there?

I'll remove this I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps so, but these generator tests are what allow me to properly debug the processor with my IDE.


public String param;

@QueryParam("named")
private String param2;

@Header private String head;
@Cookie private String cook;
public String publicQuery;

public String getParam() {
return param;
}

public void setParam(String param) {
this.param = param;
}

public String getParam2() {
return param2;
}

public void setParam2(String param2) {
this.param2 = param2;
}

public String getHead() {
return head;
}

public void setHead(String head) {
this.head = head;
}

public String getCook() {
return cook;
}

public void setCook(String cook) {
this.cook = cook;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ public void writeFormParams(Append writer) {
ParamType paramType = field.element.paramType();
String type = propertyParamType(paramType);
if (type != null) {
String accessor = (getter != null) ? getter.toString() : field.isPublic() ? field.varName() : null;
String accessor =
(getter != null)
? getter.getSimpleName() + "()"
: field.isPublic() ? field.varName() : null;
if (accessor != null) {
writer.append(" .%s(\"%s\", %s.%s)", type, field.paramName(), beanVarName, accessor).eol();
}
Expand Down