Annotation Type ProvideLink


  • @Target({METHOD,TYPE})
    @Repeatable(ProvideLinks.class)
    @Retention(RUNTIME)
    @Beta
    public @interface ProvideLink
    Use this on resource methods to contribute links to a representation. It is the inverse of InjectLink instead of annotating the target you annotate the source of the links. The added benefit is that since you annotate the method you don't need to specify the path to it.

     @ProvideLink(value = Order.class, rel = "self", bindings = @Binding(name = "orderId", value = "${instance.id}"))
     @ProvideLink(value = PaymentConfirmation.class, rel = "order",
                      bindings = @Binding(name = "orderId", value = "${instance.orderId}"))
     public Response get(@PathParam("orderId") String orderId) { ...
     

    It can also be used as a meta annotation, see the Javadoc of ProvideLink.InheritFromAnnotation for details.
    Author:
    Leonard Brünings
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      Class<?>[] value
      Provide links for representation classes listed here.
      • style

        InjectLink.Style style
        The style of URI to inject
        Default:
        org.glassfish.jersey.linking.InjectLink.Style.ABSOLUTE_PATH
      • bindings

        Binding[] bindings
        Specifies the bindings for embedded URI template parameters.
        See Also:
        Binding
        Default:
        {}
      • condition

        String condition
        Specifies a boolean EL expression whose value determines whether a Ref is set (true) or not (false). Omission of a condition will always insert a ref.
        Default:
        ""
      • rel

        String rel
        Specifies the relationship.
        Default:
        ""
      • rev

        String rev
        Specifies the reverse relationship.
        Default:
        ""
      • type

        String type
        Specifies the media type.
        Default:
        ""
      • title

        String title
        Specifies the title.
        Default:
        ""
      • anchor

        String anchor
        Specifies the anchor
        Default:
        ""
      • media

        String media
        Specifies the media
        Default:
        ""
      • hreflang

        String hreflang
        Specifies the lang of the referenced resource
        Default:
        ""
      • extensions

        InjectLink.Extension[] extensions
        Specifies extension parameters as name-value pairs.
        Default:
        {}