Class URIAdapter

java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<String,URI>
org.cruk.clarity.api.jaxb.URIAdapter

public class URIAdapter extends javax.xml.bind.annotation.adapters.XmlAdapter<String,URI>
Convert to and from URI objects, correctly encoding the query string. Can also remove the "state" parameter from the query part of a URI string before converting to a URI object, or when converting back. Turns out this is probably a bad idea after all, so it has been disabled.
  • Constructor Details

    • URIAdapter

      public URIAdapter()
  • Method Details

    • unmarshal

      public URI unmarshal(String v) throws URISyntaxException
      Convert a string into a URI.
      Specified by:
      unmarshal in class javax.xml.bind.annotation.adapters.XmlAdapter<String,URI>
      Parameters:
      v - The string to convert.
      Returns:
      A URI object for the string, or null if v is null.
      Throws:
      URISyntaxException - if the string cannot be parsed.
    • marshal

      public String marshal(URI v)
      Convert the given URI into its string format.
      Specified by:
      marshal in class javax.xml.bind.annotation.adapters.XmlAdapter<String,URI>
      Parameters:
      v - The URI to print.
      Returns:
      The URI as a string, or null if v is null.
    • removeStateParameter

      public static URI removeStateParameter(URI uri)
      Remove any "state=" parameter from the given URI.
      Parameters:
      uri - The URI to modify.
      Returns:
      A new URI which is uri without the state information.
    • removeStateParameter

      public static String removeStateParameter(String uri)
      Remove any "state=" parameter from the given URI.
      Parameters:
      uri - The URI to modify.
      Returns:
      A string which is uri without the state information.