ezvcard.util
Class TelUri

java.lang.Object
  extended by ezvcard.util.TelUri

public final class TelUri
extends Object

Represents a URI for encoding telephone numbers.

Example tel URI: tel:+1-212-555-0101

This class is immutable. Use the TelUri.Builder object to construct a new instance, or the parse(java.lang.String) method to parse a tel URI string.

Examples:

 TelUri uri = new TelUri.Builder("+1-212-555-0101").extension("123").build();
 TelUri uri = TelUri.parse("tel:+1-212-555-0101;ext=123");
 TelUri copy = new TelUri.Builder(original).extension("124").build();
 

Author:
Michael Angstadt
See Also:
RFC 3966

Nested Class Summary
static class TelUri.Builder
           
 
Method Summary
 boolean equals(Object obj)
           
 String getExtension()
          Gets the extension.
 String getIsdnSubaddress()
          Gets the ISDN sub address.
 String getNumber()
          Gets the phone number.
 String getParameter(String name)
          Gets a parameter value.
 Map<String,String> getParameters()
          Gets all parameters.
 String getPhoneContext()
          Gets the phone context.
 int hashCode()
           
static TelUri parse(String uri)
          Parses a tel URI.
 String toString()
          Converts this tel URI to its string representation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

parse

public static TelUri parse(String uri)
Parses a tel URI.

Parameters:
uri - the URI
Returns:
the parsed tel URI
Throws:
IllegalArgumentException - if the URI cannot be parsed

getNumber

public String getNumber()
Gets the phone number.

Returns:
the phone number

getPhoneContext

public String getPhoneContext()
Gets the phone context.

Returns:
the phone context (e.g. "example.com") or null if not set

getExtension

public String getExtension()
Gets the extension.

Returns:
the extension (e.g. "101") or null if not set

getIsdnSubaddress

public String getIsdnSubaddress()
Gets the ISDN sub address.

Returns:
the ISDN sub address or null if not set

getParameter

public String getParameter(String name)
Gets a parameter value.

Parameters:
name - the parameter name
Returns:
the parameter value or null if not found

getParameters

public Map<String,String> getParameters()
Gets all parameters.

Returns:
all parameters

toString

public String toString()
Converts this tel URI to its string representation.

Overrides:
toString in class Object
Returns:
the tel URI's string representation

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012-2014 Michael Angstadt. All Rights Reserved.