NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

gov.nist.javax.sip.address
Class AddressImpl

java.lang.Object
  extended by gov.nist.core.GenericObject
      extended by gov.nist.javax.sip.address.NetObject
          extended by gov.nist.javax.sip.address.AddressImpl
All Implemented Interfaces:
Serializable, Cloneable, Address

public final class AddressImpl
extends NetObject
implements Address

Address structure. Imbeds a URI and adds a display name.

Version:
1.2 $Revision: 1.11 $ $Date: 2009/07/17 18:57:21 $
Author:
M. Ranganathan
See Also:
Serialized Form

Field Summary
static int ADDRESS_SPEC
          constant field.
static int NAME_ADDR
          Constant field.
static int WILD_CARD
          Constant field.
 
Constructor Summary
AddressImpl()
           
 
Method Summary
 Object clone()
          Clones this object.
 String encode()
          Encode the address as a string and return it.
 StringBuffer encode(StringBuffer buffer)
          Put the encoded version of this object in the given StringBuffer.
 boolean equals(Object other)
          Compare two address specs for equality.
 int getAddressType()
          Get the address type;
 String getDisplayName()
          get the display name
 String getHost()
          Get the host name from the address.
 gov.nist.core.HostPort getHostPort()
          Get the host port portion of the address spec.
 int getPort()
          Get the port from the imbedded URI.
 URI getURI()
          Returns the URI address of this Address.
 String getUserAtHostPort()
          Get the user@host:port for the address field.
 boolean hasDisplayName()
          return true if DisplayName exist.
 int hashCode()
          hashCode impelmentation
 boolean isSIPAddress()
          Return true if the imbedded URI is a sip URI.
 boolean isWildcard()
          This determines if this address is a wildcard address.
 boolean match(Object other)
          Match on the address only.
 void removeDisplayName()
          remove the displayName field
 void removeParameter(String parameterName)
          Remove a parameter from the address.
 void setAddess(URI address)
          Set the address field
 void setAddressType(int atype)
          Set the address type.
 void setDisplayName(String displayName)
          Set the displayName member
 void setURI(URI address)
          Sets the URI address of this Address.
 void setUser(String user)
          Set the user name for the imbedded URI.
 void setWildCardFlag()
          Mark this a wild card address type.
 
Methods inherited from class gov.nist.javax.sip.address.NetObject
debugDump, debugDump, toString
 
Methods inherited from class gov.nist.core.GenericObject
getClassFromName, getMatcher, isMySubclass, makeClone, merge, setMatcher
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.sip.address.Address
toString
 

Field Detail

NAME_ADDR

public static final int NAME_ADDR
Constant field.

See Also:
Constant Field Values

ADDRESS_SPEC

public static final int ADDRESS_SPEC
constant field.

See Also:
Constant Field Values

WILD_CARD

public static final int WILD_CARD
Constant field.

See Also:
Constant Field Values
Constructor Detail

AddressImpl

public AddressImpl()
Method Detail

match

public boolean match(Object other)
Match on the address only. Dont care about the display name.

Overrides:
match in class NetObject
Parameters:
other - the match pattern to test against. The match object has to be of the same type (class). Primitive types and non-sip fields that are non null are matched for equality. Null in any field matches anything. Some book-keeping fields are ignored when making the comparison.
Returns:
true if match succeeds false otherwise.

getHostPort

public gov.nist.core.HostPort getHostPort()
Get the host port portion of the address spec.

Returns:
host:port in a HostPort structure.

getPort

public int getPort()
Get the port from the imbedded URI. This assumes that a SIP URL is encapsulated in this address object.

Returns:
the port from the address.

getUserAtHostPort

public String getUserAtHostPort()
Get the user@host:port for the address field. This assumes that the encapsulated object is a SipUri.

Returns:
string containing user@host:port.

getHost

public String getHost()
Get the host name from the address.

Returns:
the host name.

removeParameter

public void removeParameter(String parameterName)
Remove a parameter from the address.

Parameters:
parameterName - is the name of the parameter to remove.

encode

public String encode()
Encode the address as a string and return it.

Specified by:
encode in class gov.nist.core.GenericObject
Returns:
String canonical encoded version of this address.

encode

public StringBuffer encode(StringBuffer buffer)
Description copied from class: gov.nist.core.GenericObject
Put the encoded version of this object in the given StringBuffer.

Overrides:
encode in class gov.nist.core.GenericObject

getAddressType

public int getAddressType()
Get the address type;

Returns:
int

setAddressType

public void setAddressType(int atype)
Set the address type. The address can be NAME_ADDR, ADDR_SPEC or WILD_CARD

Parameters:
atype - int to set

getDisplayName

public String getDisplayName()
get the display name

Specified by:
getDisplayName in interface Address
Returns:
String

setDisplayName

public void setDisplayName(String displayName)
Set the displayName member

Specified by:
setDisplayName in interface Address
Parameters:
displayName - String to set

setAddess

public void setAddess(URI address)
Set the address field

Parameters:
address - SipUri to set

hashCode

public int hashCode()
hashCode impelmentation

Specified by:
hashCode in interface Address
Overrides:
hashCode in class Object
Returns:
a hash code value.

equals

public boolean equals(Object other)
Compare two address specs for equality.

Specified by:
equals in interface Address
Overrides:
equals in class NetObject
Parameters:
other - Object to compare this this address
Returns:
boolean
See Also:
Object

hasDisplayName

public boolean hasDisplayName()
return true if DisplayName exist.

Returns:
boolean

removeDisplayName

public void removeDisplayName()
remove the displayName field


isSIPAddress

public boolean isSIPAddress()
Return true if the imbedded URI is a sip URI.

Returns:
true if the imbedded URI is a SIP URI.

getURI

public URI getURI()
Returns the URI address of this Address. The type of URI can be determined by the scheme.

Specified by:
getURI in interface Address
Returns:
address parmater of the Address object

isWildcard

public boolean isWildcard()
This determines if this address is a wildcard address. That is Address.getAddress.getUserInfo() == *;

Specified by:
isWildcard in interface Address
Returns:
true if this name address is a wildcard, false otherwise.

setURI

public void setURI(URI address)
Sets the URI address of this Address. The URI can be either a TelURL or a SipURI.

Specified by:
setURI in interface Address
Parameters:
address - - the new URI address value of this NameAddress.

setUser

public void setUser(String user)
Set the user name for the imbedded URI.

Parameters:
user - -- user name to set for the imbedded URI.

setWildCardFlag

public void setWildCardFlag()
Mark this a wild card address type. Also set the SIP URI to a special wild card address.


clone

public Object clone()
Description copied from class: gov.nist.core.GenericObject
Clones this object.

Specified by:
clone in interface Address
Overrides:
clone in class gov.nist.core.GenericObject

NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Submit a bug report or feature request.