com.echomine.jabber.msg
Class DataXOption

java.lang.Object
  extended by com.echomine.jabber.msg.DataXOption

public class DataXOption
extends java.lang.Object

Supporting class for jabber:x:data support. This represents one option that is used for list-single and list-multi fields.

Since:
0.8a4
See Also:
DataXMessage, DataXField

Constructor Summary
DataXOption()
          default constructor for use to parse incoming options
DataXOption(java.lang.String value)
          accepts a value for the option
DataXOption(java.lang.String value, java.lang.String label)
          accepts a value and optionally a label.
 
Method Summary
 Element encode()
          encodes the data and returns the element for use to serialize the data over the wire
 java.lang.String getLabel()
          retrieves the label.
 java.lang.String getValue()
           
 void parse(Element opElem)
          parses the incoming option element
 void setLabel(java.lang.String label)
          sets the label.
 void setValue(java.lang.String value)
          sets the value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataXOption

public DataXOption()
default constructor for use to parse incoming options


DataXOption

public DataXOption(java.lang.String value)
accepts a value for the option


DataXOption

public DataXOption(java.lang.String value,
                   java.lang.String label)
accepts a value and optionally a label. The label can be null. If the label is null, then by default, the label will be the same as the value as per the JEP specification.

Parameters:
value - the value of the option
label - optionally the label, or null if not used (which will default to value when retrieved)
Method Detail

getLabel

public java.lang.String getLabel()
retrieves the label. If the label does not exist (ie. null), then the value will be returned instead

Returns:
the label or the value string if label is null

setLabel

public void setLabel(java.lang.String label)
sets the label. Set to null to default to using the value for the label


getValue

public java.lang.String getValue()
Returns:
the value for the option

setValue

public void setValue(java.lang.String value)
sets the value


encode

public Element encode()
               throws ParseException
encodes the data and returns the element for use to serialize the data over the wire

Throws:
ParseException

parse

public void parse(Element opElem)
           throws ParseException
parses the incoming option element

Throws:
ParseException


Copyright © 2001-2005 Echomine. All Rights Reserved.