Package org.fcrepo.client
Class FcrepoLink
- java.lang.Object
-
- org.fcrepo.client.FcrepoLink
-
public class FcrepoLink extends Object
A class representing the value of an HTTP Link header- Author:
- Aaron Coburn, bbpennel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFcrepoLink.BuilderBuilder class for link headers represented as FcrepoLinks
-
Constructor Summary
Constructors Constructor Description FcrepoLink(String link)Create a representation of a Link header.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<FcrepoLink>fromHeader(String headerValue)Parser which converts a link header containing one or more links into a list of FcrepoLink objects.static FcrepoLink.BuilderfromUri(String uri)Create a new builder instance initialized from an existing URI represented as a string.static FcrepoLink.BuilderfromUri(URI uri)Create a new builder instance initialized from an existing URI.StringgetParam(String name)Retrieve a parameter from the link headerMap<String,String>getParams()Retrieve a map of parameters from the link headerStringgetRel()Retrieve the REL portion of the linkStringgetType()Retrieve the type portion of the linkURIgetUri()Retrieve the URI of the linkStringtoString()static FcrepoLinkvalueOf(String link)Simple parser to convert a link header containing a single link into an FcrepoLink object.
-
-
-
Constructor Detail
-
FcrepoLink
public FcrepoLink(String link)
Create a representation of a Link header.- Parameters:
link- the value for a Link header
-
-
Method Detail
-
getRel
public String getRel()
Retrieve the REL portion of the link- Returns:
- the "rel" portion of a Link header
-
getType
public String getType()
Retrieve the type portion of the link- Returns:
- the "type" parameter of the header
-
getParam
public String getParam(String name)
Retrieve a parameter from the link header- Parameters:
name- name of the parameter in the link header- Returns:
- the value of the parameter or null if not present.
-
getParams
public Map<String,String> getParams()
Retrieve a map of parameters from the link header- Returns:
- map of parameters
-
fromUri
public static FcrepoLink.Builder fromUri(String uri)
Create a new builder instance initialized from an existing URI represented as a string.- Parameters:
uri- URI which will be used to initialize the builder- Returns:
- a new link builder.
- Throws:
IllegalArgumentException- if uri isnull.
-
fromUri
public static FcrepoLink.Builder fromUri(URI uri)
Create a new builder instance initialized from an existing URI.- Parameters:
uri- URI which will be used to initialize the builder- Returns:
- a new link builder.
- Throws:
IllegalArgumentException- if uri isnull.
-
valueOf
public static FcrepoLink valueOf(String link)
Simple parser to convert a link header containing a single link into an FcrepoLink object.- Parameters:
link- link header value.- Returns:
- FcrepoLink representing the link
-
fromHeader
public static List<FcrepoLink> fromHeader(String headerValue)
Parser which converts a link header containing one or more links into a list of FcrepoLink objects.- Parameters:
headerValue- link header value.- Returns:
- List containing an FcrepoLink for each link in the header value.
-
-