com.objectxp.mms
Class MMSAddress

java.lang.Object
  extended bycom.objectxp.mms.MMSAddress
All Implemented Interfaces:
java.io.Serializable

public class MMSAddress
extends java.lang.Object
implements java.io.Serializable

This class represents an MMS address.

A MMS address consists of either an email address or a device address. The syntax for email addresses is defined in RFC822. Device addresses consist of an address and a address type.

The following address types are defined:

Here are some examples of valid MMS addresses:

 0401234567/TYPE=PLMN 
 +358501234567/TYPE=PLMN 
 "Joe User" <joe@user.org> 
 FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/TYPE=IPv6 
 192.168.1.30/TYPE=IPv4
 

Since:
jSMS 2.0
See Also:
Serialized Form

Field Summary
static int TYPE_CUSTOM
          Custom address type.
static int TYPE_EMAIL
          eMail address type.
static int TYPE_IPV4
          IPv4 address type.
static int TYPE_IPV6
          IPv6 address type.
static int TYPE_PLMN
          global-phone-number address type.
 
Constructor Summary
MMSAddress(int type, java.lang.String address)
          Construct a MMSAddress of a given type.
MMSAddress(java.lang.String address)
          Construct an MMSAddress.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares this MMSAddress to the specified object.
 int getType()
          Get the Type of the Address.
 java.lang.String getValue()
          Get the value of the Address.
 int hashCode()
          Returns a hashcode for this address.
 java.lang.String toString()
          Returns the complete MMS address as String (including the type).
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_EMAIL

public static final int TYPE_EMAIL
eMail address type.

See Also:
Constant Field Values

TYPE_PLMN

public static final int TYPE_PLMN
global-phone-number address type.

See Also:
Constant Field Values

TYPE_IPV4

public static final int TYPE_IPV4
IPv4 address type.

See Also:
Constant Field Values

TYPE_IPV6

public static final int TYPE_IPV6
IPv6 address type.

See Also:
Constant Field Values

TYPE_CUSTOM

public static final int TYPE_CUSTOM
Custom address type.

See Also:
Constant Field Values
Constructor Detail

MMSAddress

public MMSAddress(java.lang.String address)
           throws java.lang.IllegalArgumentException,
                  java.lang.NullPointerException
Construct an MMSAddress. If the type of address (/TYPE=...) is not specified, the type is determined automatically.

Examples:

 new MMSAddress("+41123456789");
 new MMSAddress("john@user.org");
 new MMSAddress("192.168.1.12");
 new MMSAddress("0123765/TYPE=PLMN");
 

Parameters:
address - the MMS address.
Throws:
java.lang.IllegalArgumentException - if the type of address cannot be determined.
java.lang.NullPointerException - if the address is null.

MMSAddress

public MMSAddress(int type,
                  java.lang.String address)
           throws java.lang.IllegalArgumentException
Construct a MMSAddress of a given type.

Examples:

 new MMSAddress(MMSAddress.TYPE_EMAIL, "\"John User\" <john@user.org>");
 new MMSAddress(MMSAddress.TYPE_PLMN, "+41123456789");
 new MMSAddress(MMSAddress.TYPE_IPV4, "129.168.1.55");
 new MMSAddress(MMSAddress.TYPE_CUSTOM, "471129/TYPE=UID");
 

Parameters:
type - the address type (one of the TYPE_... constants).
address - the MMS address.
Throws:
java.lang.IllegalArgumentException - if an unknown type is used.
java.lang.IllegalArgumentException - if the address doesn't match the type.
java.lang.IllegalArgumentException - if the address is empty.
Method Detail

getValue

public java.lang.String getValue()
Get the value of the Address.

Returns:
the address value (excluding the type).

getType

public int getType()
Get the Type of the Address. Returns one of the following constant values:

Returns:
the address type.

toString

public java.lang.String toString()
Returns the complete MMS address as String (including the type).


equals

public boolean equals(java.lang.Object obj)
Compares this MMSAddress to the specified object. The result is true if and only if the argument is not null and is a MMSAddress object that contains the same address type and value.

Parameters:
obj - the object to compare this MMSAddress against.
Returns:
true if the MMSAddress is equal; false otherwise.

hashCode

public int hashCode()
Returns a hashcode for this address. The hashcode for a MMSAddress object is computed by calling hashCode() on the String returned by toString(). If getMMSAddress returns null, super.hashCode() is returned instead.

Returns:
a hash code value for this object.


object XP, Inc. © 2000-2007. All rights reserved object XP