public final class FormField
extends java.lang.Object
implements org.jivesoftware.smack.packet.FullyQualifiedElement
| Modifier and Type | Class and Description |
|---|---|
static class |
FormField.Builder |
static class |
FormField.Description |
static class |
FormField.Option
Represents the available option of a given FormField.
|
static class |
FormField.Required |
static class |
FormField.Type
Form Field Types as defined in XEP-4 § 3.3.
|
static class |
FormField.Value |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ELEMENT |
static java.lang.String |
FORM_TYPE
The constant String "FORM_TYPE".
|
static java.lang.String |
NAMESPACE |
static javax.xml.namespace.QName |
QNAME |
| Modifier and Type | Method and Description |
|---|---|
FormField.Builder |
asBuilder() |
FormField.Builder |
buildAnswer() |
static FormField.Builder |
builder() |
static FormField.Builder |
builder(java.lang.String fieldName) |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getDescription()
Returns a description that provides extra clarification about the question.
|
java.lang.String |
getElementName() |
java.lang.String |
getFirstValue()
Returns the first value of this form field or
null. |
java.util.Date |
getFirstValueAsDate()
Parses the first value of this form field as XEP-0082 date/time format and returns a date instance or
null. |
FormFieldChildElement |
getFormFieldChildElement(javax.xml.namespace.QName qname) |
java.util.List<FormFieldChildElement> |
getFormFieldChildElements(javax.xml.namespace.QName qname) |
java.lang.String |
getLabel()
Returns the label of the question which should give enough information to the user to
fill out the form.
|
java.lang.String |
getNamespace() |
java.util.List<FormField.Option> |
getOptions()
Returns a List of the available options that the user has in order to answer
the question.
|
javax.xml.namespace.QName |
getQName() |
FormField.Type |
getType()
Returns an indicative of the format for the data to answer.
|
java.util.List<java.lang.CharSequence> |
getValues()
Returns a List of the default values of the question if the question is part
of a form to fill out.
|
java.util.List<java.lang.String> |
getValuesAsString()
Returns the values a String.
|
java.lang.String |
getVariable()
Returns the field's name, also known as the variable name in case this is an filled out answer form.
|
int |
hashCode() |
static FormField |
hiddenFormType(java.lang.String value) |
boolean |
isRequired()
Returns true if the question must be answered in order to complete the questionnaire.
|
org.jivesoftware.smack.util.XmlStringBuilder |
toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) |
public static final java.lang.String ELEMENT
public static final java.lang.String NAMESPACE
public static final javax.xml.namespace.QName QNAME
public static final java.lang.String FORM_TYPE
public java.lang.String getDescription()
If the question is of type FIXED then the description should remain empty.
public java.lang.String getLabel()
public java.util.List<FormField.Option> getOptions()
public boolean isRequired()
public FormField.Type getType()
FormField.Typepublic java.util.List<java.lang.CharSequence> getValues()
public java.util.List<java.lang.String> getValuesAsString()
getValues() whenever possible instead of this
method.getValues()public java.lang.String getFirstValue()
null.nullpublic java.util.Date getFirstValueAsDate()
throws java.text.ParseException
null.java.text.ParseException - if parsing fails.public java.lang.String getVariable()
According to XEP-4 § 3.2 the variable name (the 'var' attribute) "uniquely identifies the field in the context of the form" (if the field is not of type 'fixed', in which case the field "MAY possess a 'var' attribute")
public FormFieldChildElement getFormFieldChildElement(javax.xml.namespace.QName qname)
public java.util.List<FormFieldChildElement> getFormFieldChildElements(javax.xml.namespace.QName qname)
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 javax.xml.namespace.QName getQName()
getQName in interface org.jivesoftware.smack.packet.FullyQualifiedElementpublic FormField.Builder buildAnswer()
public FormField.Builder asBuilder()
public org.jivesoftware.smack.util.XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
toXML in interface org.jivesoftware.smack.packet.Elementpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static FormField hiddenFormType(java.lang.String value)
public static FormField.Builder builder(java.lang.String fieldName)
public static FormField.Builder builder()