net.sourceforge.jsdp
Class Attribute

java.lang.Object
  extended by net.sourceforge.jsdp.Attribute
All Implemented Interfaces:
Serializable, Cloneable, Field

public class Attribute
extends Object
implements Field

An Attribute represents an a=<field value> field contained in a SDP message. Attribute fields may be of two forms:

Obviously attribute field interpretation depends on the media tool being invoked.

Since:
0.1.0
Version:
1.1
Author:
Claudio Di Vita
See Also:
Serialized Form

Field Summary
protected  String name
          The attribute property name
protected  String value
          The attribute value
 
Fields inherited from interface net.sourceforge.jsdp.Field
ATTRIBUTE_FIELD, BANDWITH_FIELD, CONNECTION_FIELD, EMAIL_FIELD, END_OF_FIELD, INFORMATION_FIELD, KEY_FIELD, MEDIA_FIELD, ORIGIN_FIELD, PHONE_FIELD, REPEAT_TIME_FIELD, SESSION_NAME_FIELD, TIME_FIELD, TIMEZONE_FIELD, URI_FIELD, VERSION_FIELD
 
Constructor Summary
protected Attribute()
          Creates a new Attribute.
  Attribute(String name)
          Creates a new Attribute.
  Attribute(String name, String value)
          Creates a new Attribute.
 
Method Summary
 Object clone()
          Returns a clone of this field.
 String getName()
          Returns the name of the attribute.
 char getType()
          Returns the type character for the field.
 String getValue()
          Returns the value of the attribute.
 boolean hasValue()
          Determines if this attribute has an associated value.
static Attribute parse(String field)
          Parse an input string and constructs the equivalent attribute field.
 void resetValue()
          Resets the attribute value.
 void setName(String name)
          Sets the name of the attribute.
 void setValue(String value)
          Sets the value of this attribute.
 String toString()
          Returns a string representation of the field.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name
The attribute property name


value

protected String value
The attribute value

Constructor Detail

Attribute

protected Attribute()
Creates a new Attribute.


Attribute

public Attribute(String name)
          throws SDPException
Creates a new Attribute.

Parameters:
name - the attribute name
Throws:
SDPException - if the name is null or not valid

Attribute

public Attribute(String name,
                 String value)
          throws SDPException
Creates a new Attribute.

Parameters:
name - the attribute name
value - the attribute value
Throws:
SDPException - if the name is null or not valid, or the value is not valid
Method Detail

parse

public static Attribute parse(String field)
                       throws SDPParseException
Parse an input string and constructs the equivalent attribute field.

Parameters:
field - the string to parse
Returns:
a new Attribute instance
Throws:
SDPParseException - if an error occurs while parsing

clone

public Object clone()
Description copied from interface: Field
Returns a clone of this field.

Specified by:
clone in interface Field
Overrides:
clone in class Object
Returns:
a clone of this field

getName

public String getName()
Returns the name of the attribute.

Returns:
the attribute name

getType

public char getType()
Returns the type character for the field.

Specified by:
getType in interface Field
Returns:
the field type character: a

getValue

public String getValue()
Returns the value of the attribute.

Returns:
a String if the attribute has an associated value null otherwise

hasValue

public boolean hasValue()
Determines if this attribute has an associated value.

Returns:
true if the attribute has a value, false otherwise

resetValue

public void resetValue()
Resets the attribute value.


setName

public void setName(String name)
             throws SDPException
Sets the name of the attribute.

Parameters:
name - the name/id of the attribute
Throws:
SDPException - if the name is null or not valid

setValue

public void setValue(String value)
              throws SDPException
Sets the value of this attribute.

Parameters:
value - the attribute value
Throws:
SDPException - if the specified value is not valid

toString

public String toString()
Returns a string representation of the field. The representation can had the following forms:

Specified by:
toString in interface Field
Overrides:
toString in class Object
Returns:
the string representation of the field


Copyright © 2004-2008. All Rights Reserved.