com.sun.jersey.server.linking
Annotation Type Ref


@Target(value=FIELD)
@Retention(value=RUNTIME)
public @interface Ref

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.


Optional Element Summary
 Binding[] bindings
          Specifies the bindings for embedded URI template parameters.
 String condition
          Specifies a boolean EL expression whose value determines whether a Ref is set (true) or not (false).
 String method
          Used in conjunction with resource() to specify a subresource locator or method.
 Class<?> resource
          Specifies a resource class whose @Path URI template will be used to build the injected URI.
 Ref.Style style
          The style of URI to inject
 String value
          Specifies a URI template that will be used to build the injected URI.
 

style

public abstract Ref.Style style
The style of URI to inject

Default:
com.sun.jersey.server.linking.Ref.Style.ABSOLUTE_PATH

value

public abstract String value
Specifies 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 as Binding.value(). URI template parameter values are resolved as described in resource(). 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

public abstract Class<?> resource
Specifies a resource class whose @Path URI template will be used to build the injected URI. Embedded URI template parameter values are resolved as follows:
  1. If the bindings() property contains a binding specification for the parameter then that is used
  2. 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 (see Binding).

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

method

public abstract String method
Used in conjunction with resource() 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

public abstract Binding[] bindings
Specifies the bindings for embedded URI template parameters.

See Also:
Binding
Default:
{}

condition

public abstract 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:
""


Copyright © 2013 Oracle Corporation. All Rights Reserved.