|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.echomine.jabber.msg.DataXField
public class DataXField
Represents the field in the jabber:x:data schema. This field will contain the data to work properly with all the different types of fields as defined by JEP-0004. Note that this is the base class. Every field type extends from this class to provide the proper convenience methods to work with each individual type.
DataXMessage
,
DataXOption
Field Summary | |
---|---|
static java.lang.String |
TYPE_BOOLEAN
|
static java.lang.String |
TYPE_FIXED
|
static java.lang.String |
TYPE_HIDDEN
|
static java.lang.String |
TYPE_JID_MULTI
|
static java.lang.String |
TYPE_JID_SINGLE
|
static java.lang.String |
TYPE_LIST_MULTI
|
static java.lang.String |
TYPE_LIST_SINGLE
|
static java.lang.String |
TYPE_TEXT_MULTI
|
static java.lang.String |
TYPE_TEXT_PRIVATE
|
static java.lang.String |
TYPE_TEXT_SINGLE
|
Constructor Summary | |
---|---|
DataXField()
default constructor to use for parsing incoming messages |
|
DataXField(java.lang.String fieldType)
constructor that requires only a field type. |
|
DataXField(java.lang.String fieldType,
java.lang.String variableName,
java.lang.String label)
constructs a field with the parameters. |
Method Summary | |
---|---|
void |
addJIDValue(JID jid)
Adds a jid to the list of field values. |
protected void |
addOption(DataXOption option)
An internal method that adds an option into the options list without doing any validation checks. |
void |
addTextValue(java.lang.String text)
adds the text to the list of field values. |
protected void |
addValue(java.lang.String value)
An internal method that simply adds the string value without doing any validation checks. |
Element |
encode()
encodes the data in this field into an XML Element contained within the designated namespace |
boolean |
getBooleanValue()
Retrieves the first value as a boolean value. |
java.lang.String |
getDescription()
|
java.lang.String |
getFieldType()
retrieves the field type (ie. |
JID |
getJIDValue()
retrieves the first value as a JID object. |
java.util.List |
getJIDValues()
retrieves all the values as a list of JID objects. |
java.lang.String |
getLabel()
|
java.util.List |
getOptions()
gets the options list. |
java.lang.String |
getStringValue()
retrieves the first value as a String type. |
java.util.List |
getStringValues()
retrieves the values sets in the field. |
java.lang.String |
getVariableName()
|
boolean |
isRequired()
whether this field is a required field for input. |
void |
parse(Element fieldElem)
parses the data out of the XML DOM elements |
void |
setBooleanValue(boolean value)
Adds a boolean value to the field. |
void |
setDescription(java.lang.String description)
sets the description |
void |
setFieldType(java.lang.String fieldType)
sets the field type for this field. |
void |
setJIDValue(JID jid)
Adds a jid to the field. |
void |
setLabel(java.lang.String label)
sets the label |
void |
setOptions(java.util.List ops)
sets the list of options to display. |
void |
setRequired(boolean required)
sets the required attribute for this field |
void |
setTextValue(java.lang.String text)
sets the field value to the text specified. |
protected void |
setValues(java.util.List values)
sets the values to a list of values you want added. |
void |
setVariableName(java.lang.String variableName)
sets the variable name |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TYPE_BOOLEAN
public static final java.lang.String TYPE_FIXED
public static final java.lang.String TYPE_HIDDEN
public static final java.lang.String TYPE_JID_MULTI
public static final java.lang.String TYPE_JID_SINGLE
public static final java.lang.String TYPE_LIST_MULTI
public static final java.lang.String TYPE_LIST_SINGLE
public static final java.lang.String TYPE_TEXT_MULTI
public static final java.lang.String TYPE_TEXT_PRIVATE
public static final java.lang.String TYPE_TEXT_SINGLE
Constructor Detail |
---|
public DataXField()
public DataXField(java.lang.String fieldType)
public DataXField(java.lang.String fieldType, java.lang.String variableName, java.lang.String label)
fieldType
- the field typevariableName
- the variable name, or null if not usedlabel
- the optional label name, or null if not usedMethod Detail |
---|
public boolean isRequired()
public void setRequired(boolean required)
public java.lang.String getDescription()
public void setDescription(java.lang.String description)
public java.lang.String getFieldType()
public void setFieldType(java.lang.String fieldType)
java.lang.IllegalArgumentException
- if the field type is not supportedpublic java.lang.String getLabel()
public void setLabel(java.lang.String label)
public java.lang.String getVariableName()
public void setVariableName(java.lang.String variableName)
public void setBooleanValue(boolean value)
value
- the boolean value to add
java.lang.IllegalArgumentException
- when the field type is not a boolean type.public void setJIDValue(JID jid)
jid
- the JID to add
java.lang.IllegalArgumentException
- when the field type is not a jid-multi typepublic void addJIDValue(JID jid)
jid
- the JID to add
java.lang.IllegalArgumentException
- when the field type is not a jid-multi typepublic void addTextValue(java.lang.String text)
text
- the text to add
java.lang.IllegalArgumentException
- when the field type is not a text-multi typepublic void setTextValue(java.lang.String text)
text
- the text to store, cannot be null
java.lang.IllegalArgumentException
- when the field type is not a text-single typepublic java.lang.String getStringValue()
public boolean getBooleanValue()
public JID getJIDValue() throws ParseException
ParseException
- if there is any problem parsing JID out of a stringpublic java.util.List getJIDValues() throws ParseException
ParseException
- if there is any problem parsing ANY JID out of the list of valuesprotected void addValue(java.lang.String value)
value
- the text value to addprotected void addOption(DataXOption option)
option
- the option to addpublic java.util.List getStringValues()
protected void setValues(java.util.List values)
public java.util.List getOptions()
public void setOptions(java.util.List ops)
ops
- a list of DataXOption objects
java.lang.IllegalArgumentException
- if the field type is not the designated typepublic void parse(Element fieldElem) throws ParseException
ParseException
public Element encode() throws ParseException
ParseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |