FileDocCategorySizeDatePackage
PhoneField.javaAPI DocphoneME MR2 API (J2ME)3578Wed May 02 18:00:42 BST 2007gov.nist.javax.sdp.fields

PhoneField

public class PhoneField extends SDPField
Phone Field SDP header.
version
JSR141-PUBLIC-REVIEW (subject to change). This code is in the public domain.

Fields Summary
protected String
name
Addressbook name.
protected String
phoneNumber
Entry phone number.
Constructors Summary
public PhoneField()
Default constructor.

	super(PHONE_FIELD);
    
Methods Summary
public java.lang.Objectclone()
Copies the current instance.

return
the copy of this object

	PhoneField retval = new PhoneField();
	retval.name = this.name;
	retval.phoneNumber = this.phoneNumber;
	return retval;
    
public java.lang.Stringencode()
Gets the string encoded version of this object. Here, we implement only the "name <phoneNumber>" form and not the "phoneNumber (name)" form

return
encoded string of object contents
since
v1.0

	String encoded_string;
	encoded_string = PHONE_FIELD;
	if (name != null) {
	    encoded_string += name + Separators.LESS_THAN;
	}
	encoded_string += phoneNumber;
	if (name != null) {
	    encoded_string += Separators.GREATER_THAN;
	}
	encoded_string += Separators.NEWLINE;
	return encoded_string;
    
public java.lang.StringgetName()
Gets the name field.

return
the name

	return name;
    
public java.lang.StringgetPhoneNumber()
Gets the phone number.

return
the textual phone number

	return phoneNumber;
    
public java.lang.StringgetValue()
Returns the value.

throws
SdpParseException if a parsing error occurs
return
the value.

	return getName();
    
public voidsetName(java.lang.String name)
Sets the name member.

param
name the name to set.

	this.name = name;
    
public voidsetPhoneNumber(java.lang.String phoneNumber)
Sets the phone number member.

param
phoneNumber phone number to set.

	this.phoneNumber = phoneNumber;
    
public voidsetValue(java.lang.String value)
Sets the value.

param
value the - new information.
throws
SdpException if the value is null

	if (value == null)
	    throw new SdpException("The value parameter is null");
	else setName(value);