ezvcard.util
Class TelUri.Builder

java.lang.Object
  extended by ezvcard.util.TelUri.Builder
Enclosing class:
TelUri

public static class TelUri.Builder
extends Object


Constructor Summary
TelUri.Builder(String globalNumber)
           Initializes the builder with a global telephone number.
TelUri.Builder(String localNumber, String phoneContext)
           Initializes the builder with a local telephone number.
TelUri.Builder(TelUri original)
          Creates a new TelUri builder.
 
Method Summary
 TelUri build()
          Builds the final TelUri object.
 TelUri.Builder extension(String extension)
          Sets the extension.
 TelUri.Builder globalNumber(String globalNumber)
           Sets the telephone number as a global number.
 TelUri.Builder isdnSubaddress(String isdnSubaddress)
          Sets the ISDN sub address.
 TelUri.Builder localNumber(String localNumber, String phoneContext)
           Sets the telephone number as a local number.
 TelUri.Builder parameter(String name, String value)
          Adds a parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TelUri.Builder

public TelUri.Builder(String globalNumber)

Initializes the builder with a global telephone number.

Global telephone numbers must:

  1. Start with "+"
  2. Contain at least 1 digit
  3. Limit themselves to the following characters:
    • 0-9 (digits)
    • - (hypen)
    • . (period)
    • ( (opening paraenthesis)
    • ) (closing paraenthesis)

Parameters:
globalNumber - the telephone number (e.g. "+1-212-555-0101")
Throws:
IllegalArgumentException - if the given telephone number does not adhere to the above rules

TelUri.Builder

public TelUri.Builder(String localNumber,
                      String phoneContext)

Initializes the builder with a local telephone number. Note, however, that the global format is preferred.

Local telephone numbers must:

  1. Contain at least 1 of the following characters:
    • 0-9 (digit)
    • * (asterisk)
    • # (hash)
  2. Limit themselves to the following characters:
    • 0-9 (digits)
    • - (hypen)
    • . (period)
    • ( (opening paraenthesis)
    • ) (closing paraenthesis)
    • * (asterisk)
    • # (hash)

Parameters:
localNumber - the telephone number (e.g. "7042")
phoneContext - the context under which the local number is valid (e.g. "example.com")
Throws:
IllegalArgumentException - if the given telephone number does not adhere to the above rules

TelUri.Builder

public TelUri.Builder(TelUri original)
Creates a new TelUri builder.

Parameters:
original - the TelUri object to copy from
Method Detail

globalNumber

public TelUri.Builder globalNumber(String globalNumber)

Sets the telephone number as a global number.

Global telephone numbers must:

  1. Start with "+"
  2. Contain at least 1 digit
  3. Limit themselves to the following characters:
    • 0-9 (digits)
    • - (hypen)
    • . (period)
    • ( (opening paraenthesis)
    • ) (closing paraenthesis)

Parameters:
globalNumber - the telephone number (e.g. "+1-212-555-0101")
Returns:
this
Throws:
IllegalArgumentException - if the given telephone number does not adhere to the above rules

localNumber

public TelUri.Builder localNumber(String localNumber,
                                  String phoneContext)

Sets the telephone number as a local number. Note, however, that the global format is preferred.

Local telephone numbers must:

  1. Contain at least 1 of the following characters:
    • 0-9 (digit)
    • * (asterisk)
    • # (hash)
  2. Limit themselves to the following characters:
    • 0-9 (digits)
    • - (hypen)
    • . (period)
    • ( (opening paraenthesis)
    • ) (closing paraenthesis)
    • * (asterisk)
    • # (hash)

Parameters:
localNumber - the telephone number (e.g. "7042")
phoneContext - the context under which the local number is valid (e.g. "example.com")
Returns:
this
Throws:
IllegalArgumentException - if the given telephone number does not adhere to the above rules

extension

public TelUri.Builder extension(String extension)
Sets the extension.

Parameters:
extension - the extension (e.g. "101") or null to remove
Returns:
this
Throws:
IllegalArgumentException - if the extension contains characters other than the following: digits, hypens, parenthesis, periods

isdnSubaddress

public TelUri.Builder isdnSubaddress(String isdnSubaddress)
Sets the ISDN sub address.

Parameters:
isdnSubaddress - the ISDN sub address or null to remove
Returns:
this

parameter

public TelUri.Builder parameter(String name,
                                String value)
Adds a parameter.

Parameters:
name - the parameter name (can only contain letters, numbers, and hyphens)
value - the parameter value or null to remove it
Returns:
this
Throws:
IllegalArgumentException - if the parameter name contains invalid characters

build

public TelUri build()
Builds the final TelUri object.

Returns:
the object


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