Class FcrepoLink


  • public class FcrepoLink
    extends Object
    A class representing the value of an HTTP Link header
    Author:
    Aaron Coburn, bbpennel
    • Constructor Detail

      • FcrepoLink

        public FcrepoLink​(String link)
        Create a representation of a Link header.
        Parameters:
        link - the value for a Link header
    • Method Detail

      • getUri

        public URI getUri()
        Retrieve the URI of the link
        Returns:
        the URI portion of a Link header
      • 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,​StringgetParams()
        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 is null.
      • 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 is null.
      • 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<FcrepoLinkfromHeader​(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.