Java Reference
In-Depth Information
public
public static
static Builder fromUriBuilder ( UriBuilder uriBuilder )
public
public static
static Builder fromLink ( Link link )
public
public static
static Builder fromPath ( String path )
public
public static
static Builder fromResource ( Class <?> resource )
public
public static
static Builder fromMethod ( Class <?> resource , String method )
All these fromXXX() methods work similarly to the UriBuilder.fromXXX() methods. They
initialize an underlying UriBuilder that is used to build the href of the link.
The link() , uri() , and uriBuilder() methods allow you to override the underlying URI
of the link you are creating:
public
public abstract
abstract class
class Link
Link {
interface
interface Builder
Builder {
public
public Builder link ( Link link );
public
public Builder link ( String link );
public
public Builder uri ( URI uri );
public
public Builder uri ( String uri );
public
public Builder uriBuilder ( UriBuilder uriBuilder );
...
As you can probably guess, the following methods allow you to set various attributes on the
link you are building:
public
public Builder rel ( String rel );
public
public Builder title ( String title );
public
public Builder type ( String type );
public
public Builder param ( String name , String value );
Finally, there's the build() method that will create the link:
public
public Link build ( Object ... values );
The Link.Builder has an underlying UriBuilder . The values passed into the build()
method are passed along to this UriBuilder to create the URI for the Link . Let's look at an
example:
Link link = Link . fromUri ( "http://{host}/root/customers/{id}" )
. rel ( "update" ). type ( "text/plain" )
. build ( "localhost" , "1234" );
Calling toString() on the link instance will result in:
< http: //localhost/root/customers/1234>; rel="update"; type="text/plain"
You can also build relativized links using the buildRelativized() method:
public
public Link buildRelativized ( URI uri , Object ... values );
Search WWH ::




Custom Search