public final class DataForm
extends java.lang.Object
implements org.jivesoftware.smack.packet.ExtensionElement
Note that unlike many other things in XMPP, the order of the form fields is actually Important in data forms.
| Modifier and Type | Class and Description |
|---|---|
static class |
DataForm.Builder |
static class |
DataForm.Item
Represents items of reported data.
|
static class |
DataForm.ReportedData
Represents the fields that will be returned from a search.
|
static class |
DataForm.Type |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ELEMENT |
static java.lang.String |
NAMESPACE |
static javax.xml.namespace.QName |
QNAME |
| Modifier and Type | Method and Description |
|---|---|
DataForm.Builder |
asBuilder() |
static DataForm.Builder |
builder()
Get a new data form builder with the form type set to
DataForm.Type.submit. |
static DataForm.Builder |
builder(DataForm.Type type) |
static DataForm |
from(java.util.Collection<DataForm> dataForms,
java.lang.String formType)
Return the first matching data form with the given form type from the given collection of data forms.
|
static DataForm |
from(org.jivesoftware.smack.packet.StanzaView stanzaView)
Get data form from a stanza.
|
static DataForm |
from(org.jivesoftware.smack.packet.StanzaView stanzaView,
java.lang.String formType)
Get the data form with the given form type from a stanza view.
|
java.lang.String |
getElementName() |
java.util.List<org.jivesoftware.smack.packet.Element> |
getExtensionElements() |
FormField |
getField(java.lang.String fieldName)
Return the form field with the given variable name or null.
|
java.util.List<FormField> |
getFields()
Returns a List of the fields that are part of the form.
|
java.lang.String |
getFormType()
Return the form type from the hidden form type field.
|
TextSingleFormField |
getHiddenFormTypeField()
Returns the hidden FORM_TYPE field or null if this data form has none.
|
java.util.List<java.lang.String> |
getInstructions()
Returns a List of the list of instructions that explain how to fill out the form and
what the form is about.
|
java.util.List<DataForm.Item> |
getItems()
Returns a List of the items returned from a search.
|
java.lang.String |
getNamespace() |
DataForm.ReportedData |
getReportedData()
Returns the fields that will be returned from a search.
|
java.lang.String |
getTitle()
Returns the description of the data.
|
DataForm.Type |
getType()
Returns the meaning of the data within the context.
|
boolean |
hasField(java.lang.String fieldName)
Check if a form field with the given variable name exists.
|
boolean |
hasHiddenFormTypeField()
Returns true if this DataForm has at least one FORM_TYPE field which is
hidden.
|
static DataForm |
remove(java.util.Collection<DataForm> dataForms,
java.lang.String formType)
Remove the first matching data form with the given form type from the given collection.
|
org.jivesoftware.smack.util.XmlStringBuilder |
toXML(org.jivesoftware.smack.packet.XmlEnvironment xmlEnvironment) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final java.lang.String NAMESPACE
public static final java.lang.String ELEMENT
public static final javax.xml.namespace.QName QNAME
public DataForm.Type getType()
public java.lang.String getTitle()
public java.util.List<java.lang.String> getInstructions()
public DataForm.ReportedData getReportedData()
public java.util.List<DataForm.Item> getItems()
public java.util.List<FormField> getFields()
public FormField getField(java.lang.String fieldName)
fieldName - the name of the field (the value of the 'var' (variable) attribute)public boolean hasField(java.lang.String fieldName)
fieldName - the name of the field.public java.lang.String getElementName()
getElementName in interface org.jivesoftware.smack.packet.NamedElementpublic java.lang.String getNamespace()
getNamespace in interface org.jivesoftware.smack.packet.FullyQualifiedElementpublic java.util.List<org.jivesoftware.smack.packet.Element> getExtensionElements()
public java.lang.String getFormType()
null if this form has none set.public TextSingleFormField getHiddenFormTypeField()
public boolean hasHiddenFormTypeField()
public org.jivesoftware.smack.util.XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment xmlEnvironment)
toXML in interface org.jivesoftware.smack.packet.Elementpublic DataForm.Builder asBuilder()
public static DataForm from(org.jivesoftware.smack.packet.StanzaView stanzaView)
stanzaView - the stanza to get data form from.public static DataForm from(org.jivesoftware.smack.packet.StanzaView stanzaView, java.lang.String formType)
stanzaView - the stanza view to retrieve the data form fromformType - the form typenull if there is no matching onepublic static DataForm from(java.util.Collection<DataForm> dataForms, java.lang.String formType)
dataForms - the collection of data formsformType - the form type to match fornull if there is nonepublic static DataForm remove(java.util.Collection<DataForm> dataForms, java.lang.String formType)
dataForms - the collection of data formsformType - the form type to match fornull if there was none removedpublic static DataForm.Builder builder()
DataForm.Type.submit.public static DataForm.Builder builder(DataForm.Type type)