Enum Class RestLinkType

java.lang.Object
java.lang.Enum<RestLinkType>
io.quarkus.resteasy.reactive.links.RestLinkType
All Implemented Interfaces:
Serializable, Comparable<RestLinkType>, Constable

public enum RestLinkType extends Enum<RestLinkType>
Manage the link types to be injected in the Web links.
  • Enum Constant Details

    • TYPE

      public static final RestLinkType TYPE
      It will inject the links that return the link type RestLink.entityType() without filtering or searching. For example:
           @GET
           @Path("/records")
           @RestLink(rel = "list")
           @InjectRestLinks(RestLinkType.TYPE)
           public List getAll() { // ... }
      
           @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

      public static final RestLinkType INSTANCE
      It will inject all the links that return the link type RestLink.entityType(). For example:
      
           @GET
           @RestLink(rel = "list")
           public List 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) { // ... }
       

      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

      public static RestLinkType[] 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

      public static RestLinkType valueOf(String name)
      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 name
      NullPointerException - if the argument is null