Class URIData

java.lang.Object
com.isode.dsapi.syntax.URIData
All Implemented Interfaces:
Comparable<URIData>

public class URIData extends Object implements Comparable<URIData>
This class stores information about a network address in the URI format.

This is an immutable class.

Examples:

http://127.0.0.1

itot://[FFEF::1]:19000

ldap://mv@127.0.0.1

ldaps://localhost:19000/

Since:
15.0
Author:
mv
  • Constructor Details

    • URIData

      public URIData(String host, int port, String scheme) throws BadValueException
      Constructor to create an object with the given data.
      Parameters:
      host - Host name.
      port - Port.
      scheme - Scheme.
      Throws:
      BadValueException - if any of the input is invalid.
    • URIData

      public URIData(String str) throws BadValueException
      Constructor to create an object with the given data.
      Parameters:
      str - String representation of a URI data.
      Throws:
      BadValueException - if the input is invalid.
    • URIData

      public URIData(URIData uriDataToCopy, String hostName) throws BadValueException
      Constructor to create an object which is a copy of the given object but replaces the host name with the given host name.
      Parameters:
      uriDataToCopy - object to copy, must not be null
      hostName - Host name, must not be null
      Throws:
      BadValueException - if any of the input is invalid.
    • URIData

      public URIData(URIData uriDataToCopy, String hostName, int portNo) throws BadValueException
      Creates a copy of the given URIData, but which replaces the hostName and portNo with the given values.
      Parameters:
      uriDataToCopy - The URIData to copy.
      hostName - The new host name, must not be null.
      portNo - The new port no.
      Throws:
      BadValueException - If any of the input is invalid.
      Since:
      16.0
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getHost

      public String getHost()
      Returns the host name of the URI data object.
      Returns:
      Host name of the URI data, will never be null
    • getPort

      public int getPort()
      Returns the port of the URI data object.
      Returns:
      Port of the URI data.
    • getScheme

      public String getScheme()
      Returns the scheme of the URI data object.
      Returns:
      Scheme of the URI data.
    • getCanonicalForm

      public URIData getCanonicalForm()
      The scheme is converted to lower case. The URI class does not have a method to return the canonical form, so uri is kept as it is.
      Returns:
      canonical form of object.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(URIData o)
      Specified by:
      compareTo in interface Comparable<URIData>