Package org.glassfish.jersey.linking
Annotation Interface InjectLink
Specifies a link injection target in a returned representation bean. May be
used on fields of type String or URI. One of
value()
or
resource()
must be specified.- Author:
- Mark Hadley, Gerard Davison (gerard.davison at oracle.com)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
static enum
Styles of URI supportedstatic class
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionSpecifies the anchorBinding[]
Specifies the bindings for embedded URI template parameters.Specifies a boolean EL expression whose value determines whether a Ref is set (true) or not (false).Specifies extension parameters as name-value pairs.Specifies the lang of the referenced resourceSpecifies the mediaUsed in conjunction withresource()
to specify a subresource locator or method.Specifies the relationship.Class<?>
Specifies a resource class whose @Path URI template will be used to build the injected URI.Specifies the reverse relationship.The style of URI to injectSpecifies the title.Specifies the media type.Specifies a URI template that will be used to build the injected URI.
-
Element Details
-
style
InjectLink.Style styleThe style of URI to inject- Default:
- ABSOLUTE_PATH
-
value
String valueSpecifies a URI template that will be used to build the injected URI. The template may contain both URI template parameters (e.g. {id}) and EL expressions (e.g. ${instance.id}) using the same implicit beans asBinding.value()
. URI template parameter values are resolved as described inresource()
. E.g. the following three alternatives are equivalent:@Ref("{id}") @Ref(value="{id}", bindings={ @Binding(name="id" value="${instance.id}"} ) @Ref("${instance.id}")
- Default:
- ""
-
resource
Class<?> resourceSpecifies a resource class whose @Path URI template will be used to build the injected URI. Embedded URI template parameter values are resolved as follows:- If the
bindings()
property contains a binding specification for the parameter then that is used - Otherwise an implicit binding is used that extracts the value of a
bean property by the same name as the URI template from the implicit
instance
bean (seeBinding
).
E.g. assuming a resource class
SomeResource
with the following@Path("{id}")
annotation, the following two alternatives are therefore equivalent:@Ref(resource=SomeResource.class) @Ref(resource=SomeResource.class, bindings={ @Binding(name="id" value="${instance.id}"} )
- Default:
- java.lang.Class.class
- If the
-
method
String methodUsed in conjunction withresource()
to specify a subresource locator or method. The value is the name of the method. The value of the method's @Path annotation will be appended to the value of the class-level @Path annotation separated by '/' if necessary.- Default:
- ""
-
bindings
Binding[] bindingsSpecifies the bindings for embedded URI template parameters.- See Also:
- Default:
- {}
-
condition
String conditionSpecifies 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 relSpecifies the relationship.- Default:
- ""
-
rev
String revSpecifies the reverse relationship.- Default:
- ""
-
type
String typeSpecifies the media type.- Default:
- ""
-
title
String titleSpecifies the title.- Default:
- ""
-
anchor
String anchorSpecifies the anchor- Default:
- ""
-
media
String mediaSpecifies the media- Default:
- ""
-
hreflang
String hreflangSpecifies the lang of the referenced resource- Default:
- ""
-
extensions
InjectLink.Extension[] extensionsSpecifies extension parameters as name-value pairs.- Default:
- {}
-