-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added documentation for resteasy reactive links.
- Loading branch information
Showing
7 changed files
with
205 additions
and
6 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
75 changes: 75 additions & 0 deletions
75
...reactive-links/runtime/src/main/java/io/quarkus/resteasy/reactive/links/RestLinkType.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 |
---|---|---|
@@ -1,6 +1,81 @@ | ||
package io.quarkus.resteasy.reactive.links; | ||
|
||
/** | ||
* Manage the link types to be injected in the Web links. | ||
*/ | ||
public enum RestLinkType { | ||
/** | ||
* It will inject the links that return the link type {@link RestLink#entityType()} without filtering or searching. | ||
* For example: | ||
* | ||
* <pre> | ||
* @GET | ||
* @Path("/records") | ||
* @RestLink(rel = "list") | ||
* @InjectRestLinks(RestLinkType.TYPE) | ||
* public List<Record> getAll() { // ... } | ||
* | ||
* @GET | ||
* @Path("/records/valid") | ||
* @RestLink | ||
* public List<Record> getValidRecords() { // ... } | ||
* | ||
* @GET | ||
* @Path("/records/{id}") | ||
* @RestLink(rel = "self") | ||
* public TestRecord getById(@PathParam("id") int id) { // ... } | ||
* </pre> | ||
* <p> | ||
* Note that the method `getAll` is annotated with `@InjectRestLinks(RestLinkType.TYPE)`, so when calling to the endpoint | ||
* `/records`, it will inject the following links: | ||
* | ||
* <pre> | ||
* Link: <http://localhost:8080/records>; rel="list" | ||
* Link: <http://localhost:8080/records/valid>; rel="getValidRecords" | ||
* </pre> | ||
* <p> | ||
* The method `getById` is not injected because it's instance based (it depends on the field `id`). | ||
*/ | ||
TYPE, | ||
|
||
/** | ||
* It will inject all the links that return the link type {@link RestLink#entityType()}. | ||
* For example: | ||
* | ||
* <pre> | ||
* | ||
* @GET | ||
* @RestLink(rel = "list") | ||
* public List<TestRecord> getAll() { // ... } | ||
* | ||
* @GET | ||
* @Path("/records/{id}") | ||
* @RestLink(rel = "self") | ||
* @InjectRestLinks(RestLinkType.INSTANCE) | ||
* public TestRecord getById(@PathParam("id") int id) { // ... } | ||
* | ||
* @GET | ||
* @Path("/records/{slug}") | ||
* @RestLink | ||
* public TestRecord getBySlug(@PathParam("slug") String slug) { // ... } | ||
* | ||
* @DELETE | ||
* @Path("/records/{id}") | ||
* @RestLink | ||
* public TestRecord delete(@PathParam("slug") String slug) { // ... } | ||
* </pre> | ||
* <p> | ||
* Note that the method `getById` is annotated with `@InjectRestLinks(RestLinkType.INSTANCE)`, so when calling to the | ||
* endpoint `/records/1`, it will inject the following links: | ||
* | ||
* <pre> | ||
* Link: <http://localhost:8080/records>; rel="list" | ||
* Link: <http://localhost:8080/records/1>; rel="self" | ||
* Link: <http://localhost:8080/records/theSlugValueInRecord1>; rel="getBySlug" | ||
* Link: <http://localhost:8080/records/1>; rel="delete" | ||
* </pre> | ||
* <p> | ||
* Now, all the links have been injected. | ||
*/ | ||
INSTANCE | ||
} |
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