org.jboss.resteasy.specimpl

## Class LinkBuilderImpl

- java.lang.Object
- - org.jboss.resteasy.specimpl.LinkBuilderImpl

- All Implemented Interfaces:
    Link.Builder

      public class LinkBuilderImpl
      extends Object
      implements Link.Builder

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected URI` | `baseUri`
    `protected LinkImpl` | `link`
    `protected UriBuilder` | `uriBuilder`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LinkBuilderImpl()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Link.Builder` | `baseUri(String uri)` Set the base URI as a string for resolution of relative URIs.
    `Link.Builder` | `baseUri(URI uri)` Set the base URI for resolution of relative URIs.
    `Link` | `build(Object... values)` Finish building this link using the supplied values as URI parameters.
    `Link` | `buildRelativized(URI uri, Object... values)` Finish building this link using the supplied values as URI parameters and relativize the result with respect to the supplied URI.
    `Link.Builder` | `link(Link link)` Initialize builder using another link.
    `Link.Builder` | `link(String link)` Initialize builder using another link represented as a string.
    `Link.Builder` | `param(String name, String value)` Set an arbitrary parameter on this link.
    `Link.Builder` | `rel(String rel)` Convenience method to set a link relation.
    `Link.Builder` | `title(String title)` Convenience method to set a `title` on this link.
    `Link.Builder` | `type(String type)` Convenience method to set a `type` on this link.
    `Link.Builder` | `uri(String uri)` Set underlying string representing URI template for the link being constructed.
    `Link.Builder` | `uri(URI uri)` Set underlying URI template for the link being constructed.
    `Link.Builder` | `uriBuilder(UriBuilder uriBuilder)` Set underlying URI builder representing the URI template for the link being constructed.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### link

          protected LinkImpl link

    - #### uriBuilder

          protected UriBuilder uriBuilder

    - #### baseUri

          protected URI baseUri

  - ### Constructor Detail

    - #### LinkBuilderImpl

          public LinkBuilderImpl()

  - ### Method Detail

    - #### link

          public Link.Builder link(Link link)

      Description copied from interface: `Link.Builder`
      Initialize builder using another link. Sets underlying URI and copies all parameters.
      Specified by:
        `link` in interface `Link.Builder`
      Parameters:
        `link` - other link from which to initialize.
      Returns:
        the updated builder.

    - #### link

          public Link.Builder link(String link)

      Description copied from interface: `Link.Builder`
      Initialize builder using another link represented as a string. Uses simple parser to convert string representation into a link.

           link ::= '<' uri '>' (';' link-param)*
           link-param ::= name '=' quoted-string

      See RFC 5988 for more information.
      Specified by:
        `link` in interface `Link.Builder`
      Parameters:
        `link` - other link in string representation.
      Returns:
        the updated builder.

    - #### uriBuilder

          public Link.Builder uriBuilder(UriBuilder uriBuilder)

      Description copied from interface: `Link.Builder`
      Set underlying URI builder representing the URI template for the link being constructed.
      Specified by:
        `uriBuilder` in interface `Link.Builder`
      Parameters:
        `uriBuilder` - underlying URI builder.
      Returns:
        the updated builder.

    - #### uri

          public Link.Builder uri(URI uri)

      Description copied from interface: `Link.Builder`
      Set underlying URI template for the link being constructed.
      Specified by:
        `uri` in interface `Link.Builder`
      Parameters:
        `uri` - underlying URI for link
      Returns:
        the updated builder.

    - #### uri

          public Link.Builder uri(String uri)
                           throws IllegalArgumentException

      Description copied from interface: `Link.Builder`
      Set underlying string representing URI template for the link being constructed.
      Specified by:
        `uri` in interface `Link.Builder`
      Parameters:
        `uri` - underlying URI for link.
      Returns:
        the updated builder.
      Throws:
        `IllegalArgumentException` - if string representation of URI is invalid.

    - #### rel

          public Link.Builder rel(String rel)

      Description copied from interface: `Link.Builder`
      Convenience method to set a link relation. More than one `rel` value can be specified by using one or more whitespace characters as delimiters according to RFC 5988. The effect of calling this method is cumulative; relations are appended using a single space character as separator.
      Specified by:
        `rel` in interface `Link.Builder`
      Parameters:
        `rel` - relation name.
      Returns:
        the updated builder.

    - #### title

          public Link.Builder title(String title)

      Description copied from interface: `Link.Builder`
      Convenience method to set a `title` on this link.
      Specified by:
        `title` in interface `Link.Builder`
      Parameters:
        `title` - title parameter of this link.
      Returns:
        the updated builder.

    - #### type

          public Link.Builder type(String type)

      Description copied from interface: `Link.Builder`
      Convenience method to set a `type` on this link.
      Specified by:
        `type` in interface `Link.Builder`
      Parameters:
        `type` - type parameter of this link.
      Returns:
        the updated builder.

    - #### param

          public Link.Builder param(String name,
                           String value)
                             throws IllegalArgumentException

      Description copied from interface: `Link.Builder`
      Set an arbitrary parameter on this link. Note that link parameters are those defined in RFC 5988 and should not be confused with URI parameters which can be specified when calling `Link.Builder.build(Object...)`.
      Specified by:
        `param` in interface `Link.Builder`
      Parameters:
        `name` - the name of the parameter.
        `value` - the value set for the parameter.
      Returns:
        the updated builder.
      Throws:
        `IllegalArgumentException` - if either the name or value are `null`.

    - #### build

          public Link build(Object... values)
                     throws UriBuilderException

      Description copied from interface: `Link.Builder`
      Finish building this link using the supplied values as URI parameters. The state of the builder is unaffected; this method may be called multiple times on the same builder instance.
      Specified by:
        `build` in interface `Link.Builder`
      Parameters:
        `values` - parameters used to build underlying URI.
      Returns:
        newly built link.
      Throws:
        `UriBuilderException` - if a URI cannot be constructed based on the current state of the underlying URI builder.

    - #### buildRelativized

          public Link buildRelativized(URI uri,
                              Object... values)

      Description copied from interface: `Link.Builder`
      Finish building this link using the supplied values as URI parameters and relativize the result with respect to the supplied URI. If the underlying link is already relative or if it is absolute but does not share a prefix with the supplied URI, this method is equivalent to calling `Link.Builder.build(java.lang.Object[])`. Note that a base URI can be set on a relative link using `Link.Builder.baseUri(java.net.URI)`. The state of the builder is unaffected; this method may be called multiple times on the same builder instance.
      Specified by:
        `buildRelativized` in interface `Link.Builder`
      Parameters:
        `uri` - URI used for relativization.
        `values` - parameters used to build underlying URI.
      Returns:
        newly built link.
      See Also:
        `Link.Builder.baseUri(java.lang.String)`, `Link.Builder.baseUri(java.net.URI)`

    - #### baseUri

          public Link.Builder baseUri(URI uri)

      Description copied from interface: `Link.Builder`
      Set the base URI for resolution of relative URIs. If the underlying URI is already absolute, the base URI is ignored.
      Specified by:
        `baseUri` in interface `Link.Builder`
      Parameters:
        `uri` - base URI for relative links.
      Returns:
        the updated builder.
      See Also:
        `Link.fromPath(java.lang.String)`, `Link.fromResource(java.lang.Class)`, `Link.fromMethod(java.lang.Class, java.lang.String)`

    - #### baseUri

          public Link.Builder baseUri(String uri)

      Description copied from interface: `Link.Builder`
      Set the base URI as a string for resolution of relative URIs. If the underlying URI is already absolute, the base URI is ignored.
      Specified by:
        `baseUri` in interface `Link.Builder`
      Parameters:
        `uri` - base URI for relative links.
      Returns:
        the updated builder.
      See Also:
        `Link.fromPath(java.lang.String)`, `Link.fromResource(java.lang.Class)`, `Link.fromMethod(java.lang.Class, java.lang.String)`

Copyright © 2014. All Rights Reserved.