-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved method resolution on inherited types; refactored type creation;
- Loading branch information
Showing
10 changed files
with
241 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...m/sebastian_daschner/jaxrs_analyzer/analysis/project/classes/testclasses/TestClass10.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.sebastian_daschner.jaxrs_analyzer.analysis.project.classes.testclasses; | ||
|
||
import com.sebastian_daschner.jaxrs_analyzer.builder.ClassResultBuilder; | ||
import com.sebastian_daschner.jaxrs_analyzer.builder.HttpResponseBuilder; | ||
import com.sebastian_daschner.jaxrs_analyzer.builder.MethodResultBuilder; | ||
import com.sebastian_daschner.jaxrs_analyzer.model.rest.HttpMethod; | ||
import com.sebastian_daschner.jaxrs_analyzer.model.results.ClassResult; | ||
import com.sebastian_daschner.jaxrs_analyzer.model.results.MethodResult; | ||
import com.sebastian_daschner.jaxrs_analyzer.model.types.Types; | ||
|
||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Response; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@Path("test") | ||
public class TestClass10 extends ATestClass10 { | ||
|
||
@Override | ||
public Response getInfo(final String info) { | ||
final Map<String, Integer> map = new HashMap<>(); | ||
map.put(info, 100); | ||
return createResponse(map); | ||
} | ||
|
||
public static ClassResult getResult() { | ||
final MethodResult method = MethodResultBuilder.withResponses(HttpResponseBuilder.withStatues(200).andEntityTypes(Types.STRING).andHeaders("X-Test").build()) | ||
.andPath("{info}").andMethod(HttpMethod.POST).andRequestBodyType(Types.STRING).build(); | ||
return ClassResultBuilder.withResourcePath("test").andMethods(method).build(); | ||
} | ||
|
||
} | ||
|
||
abstract class ATestClass10 { | ||
|
||
@POST | ||
@Path("{info}") | ||
public abstract Response getInfo(final String info); | ||
|
||
protected final Response createResponse(final Map<String, Integer> map) { | ||
return Response.ok("hello").header("X-Test", "world").build(); | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
...m/sebastian_daschner/jaxrs_analyzer/analysis/project/classes/testclasses/TestClass11.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.sebastian_daschner.jaxrs_analyzer.analysis.project.classes.testclasses; | ||
|
||
import com.sebastian_daschner.jaxrs_analyzer.builder.ClassResultBuilder; | ||
import com.sebastian_daschner.jaxrs_analyzer.builder.HttpResponseBuilder; | ||
import com.sebastian_daschner.jaxrs_analyzer.builder.MethodResultBuilder; | ||
import com.sebastian_daschner.jaxrs_analyzer.model.rest.HttpMethod; | ||
import com.sebastian_daschner.jaxrs_analyzer.model.results.ClassResult; | ||
import com.sebastian_daschner.jaxrs_analyzer.model.results.MethodResult; | ||
import com.sebastian_daschner.jaxrs_analyzer.model.types.Type; | ||
import com.sebastian_daschner.jaxrs_analyzer.model.types.Types; | ||
|
||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.GenericEntity; | ||
import javax.ws.rs.core.Response; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@Path("test") | ||
public class TestClass11 extends ATestClass11 { | ||
|
||
@Override | ||
public Response getInfo(final String info) { | ||
return Response.ok(getContent(info)).build(); | ||
} | ||
|
||
public static ClassResult getResult() { | ||
final MethodResult method = MethodResultBuilder.withResponses(HttpResponseBuilder.withStatues(200).andEntityTypes(new Type("javax.ws.rs.core.GenericEntity"), | ||
new Type("javax.ws.rs.core.GenericEntity<java.util.List<java.lang.String>>")).build()) | ||
.andPath("{info}").andMethod(HttpMethod.POST).andRequestBodyType(Types.STRING).build(); | ||
return ClassResultBuilder.withResourcePath("test").andMethods(method).build(); | ||
} | ||
|
||
} | ||
|
||
abstract class ATestClass11 { | ||
|
||
@POST | ||
@Path("{info}") | ||
public abstract Response getInfo(final String info); | ||
|
||
protected final GenericEntity<List<String>> getContent(final String content) { | ||
// TODO change to direct return, without variable declaration | ||
final GenericEntity<List<String>> entity = new GenericEntity<>(Collections.singletonList(content), List.class); | ||
return entity; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.