Enum Class RestLinkType
- All Implemented Interfaces:
Serializable,Comparable<RestLinkType>,Constable
Manage the link types to be injected in the Web links.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionIt will inject all the links that return the link typeRestLink.entityType().It will inject the links that return the link typeRestLink.entityType()without filtering or searching. -
Method Summary
Modifier and TypeMethodDescriptionstatic RestLinkTypeReturns the enum constant of this class with the specified name.static RestLinkType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TYPE
It will inject the links that return the link typeRestLink.entityType()without filtering or searching. For example:@GET @Path("/records") @RestLink(rel = "list") @InjectRestLinks(RestLinkType.TYPE) public ListgetAll() { // ... } @GET @Path("/records/valid") @RestLink public List getValidRecords() { // ... } @GET @Path("/records/{id}") @RestLink(rel = "self") public TestRecord getById(@PathParam("id") int id) { // ... } Note that the method `getAll` is annotated with `@InjectRestLinks(RestLinkType.TYPE)`, so when calling to the endpoint `/records`, it will inject the following links:
Link: <http://localhost:8080/records>; rel="list" Link: <http://localhost:8080/records/valid>; rel="getValidRecords"
The method `getById` is not injected because it's instance based (it depends on the field `id`).
-
INSTANCE
It will inject all the links that return the link typeRestLink.entityType(). For example:@GET @RestLink(rel = "list") public ListgetAll() { // ... } @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) { // ... } 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:
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"
Now, all the links have been injected.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-