org.apache.wink.server.utils
Interface BaseLinksBuilder<T>

Type Parameters:
T - the derived type of the links builder
All Known Subinterfaces:
SingleLinkBuilder, SystemLinksBuilder

public interface BaseLinksBuilder<T>

Base interface for the the two types of link builders.

See Also:
SingleLinkBuilder, SystemLinksBuilder

Method Summary
 T addAltParam(boolean addAltParam)
          Set whether the to automatically add to the generated links the "alt" query parameter indicating the link type.
 T baseUri(java.net.URI base)
          Set the base uri for this builder.
 java.util.List<SyndLink> build(java.util.List<SyndLink> out)
          Build the link(s) and add them to the provided list.
 T pathParam(java.lang.String name, java.lang.String value)
          Set the value of a template path parameter to be used during the building of the links.
 T queryParam(java.lang.String name, java.lang.String value)
          Set the value of a query parameter to be added to the generated links
 T relativeTo(java.net.URI relativeTo)
          Set the uri that the generated links will be relative to, if the generation mode is relative uri's.
 T relativize(boolean relativize)
          Set whether the links should be generated absolute or relative, overriding any configuration and request settings.
 T resource(java.lang.Class<?> resource)
          Set the resource class that the generated links should link to.
 T resource(java.lang.Object resource)
          Set the resource instance that the generated links should link to.
 T subResource(java.lang.String template)
          Set the sub-resource path that the generated links should link to, relative to the resource set in the builder.
 

Method Detail

resource

T resource(java.lang.Class<?> resource)
Set the resource class that the generated links should link to. If no resource is set then the active resource is used. Setting the resource clears any sub-resource path previously set.

Parameters:
resource - a resource class annotated with the Path annotation
Returns:
this links builder

resource

T resource(java.lang.Object resource)
Set the resource instance that the generated links should link to. If no resource is set then the active resource is used. Setting the resource clears any sub-resource path previously set.

Parameters:
resource - a resource instance, or null to use the current resource
Returns:
this links builder

subResource

T subResource(java.lang.String template)
Set the sub-resource path that the generated links should link to, relative to the resource set in the builder.

Parameters:
template - the template path of the sub-resource
Returns:
this links builder

baseUri

T baseUri(java.net.URI base)
Set the base uri for this builder. If not set, or if set to null, then the base uri as obtained from UriInfo.getBaseUri() is used.

Parameters:
base - the base uri for this builder, or null
Returns:
this links builder

relativeTo

T relativeTo(java.net.URI relativeTo)
Set the uri that the generated links will be relative to, if the generation mode is relative uri's. The uri being set must be absolute and must be prefixed with the base uri set on this links builder. If not set, or if set to null, then the generated links will be relative to the path obtained from UriInfo.getPath().

Parameters:
relativeTo - the relative uri for this builder, or null
Returns:
this links builder

pathParam

T pathParam(java.lang.String name,
            java.lang.String value)
Set the value of a template path parameter to be used during the building of the links.

Parameters:
name - the name of the path parameter
value - the value of the path parameter
Returns:
this links builder

queryParam

T queryParam(java.lang.String name,
             java.lang.String value)
Set the value of a query parameter to be added to the generated links

Parameters:
name - the name of the query parameter to add to the generated links
value - the value of the query parameter
Returns:
this links builder

relativize

T relativize(boolean relativize)
Set whether the links should be generated absolute or relative, overriding any configuration and request settings. If this method is not called, the behavior is taken from the value of the "relative-urls" query parameter on the request. If the request does not have the query parameter, the behavior is taken from the wink.defaultUrisRelative configuration property.

Parameters:
relativize - true to produce relative links, false to produce absolute links
Returns:
this links builder

addAltParam

T addAltParam(boolean addAltParam)
Set whether the to automatically add to the generated links the "alt" query parameter indicating the link type. The "alt" query parameter will never be added automatically in case if it was added manually. If this method is not called, the default behavior is taken from the wink.addAltParam configuration property.

Parameters:
addAltParam - true to add the "alt" parameter
Returns:

build

java.util.List<SyndLink> build(java.util.List<SyndLink> out)
Build the link(s) and add them to the provided list. The state of the builder is not affected by this method.

Parameters:
out - the output list of links to add the generated link(s) to. If the provided list is null then a new list is created.
Returns:
the provided (or new) output list.


Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.