Class ValidateElement
- java.lang.Object
-
- org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement
-
- All Implemented Interfaces:
Element,NamedElement,XmlElement,XmlLangElement,FormFieldChildElement
- Direct Known Subclasses:
ValidateElement.BasicValidateElement,ValidateElement.OpenValidateElement,ValidateElement.RangeValidateElement,ValidateElement.RegexValidateElement
public abstract class ValidateElement extends Object implements FormFieldChildElement
DataValidation Extension according to XEP-0122: Data Forms Validation. This specification defines a backwards-compatible extension to the XMPP Data Forms protocol that enables applications to specify additional validation guidelines related to aFormFieldin aDataForm, such as validation of standard XML datatypes, application-specific datatypes, value ranges, and regular expressions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classValidateElement.BasicValidateElementValidation only against the datatype itself.static classValidateElement.ListRangeThis element indicates for "list-multi", that a minimum and maximum number of options should be selected and/or entered.static classValidateElement.OpenValidateElementFor "list-single" or "list-multi", indicates that the user may enter a custom value (matching the datatype constraints) or choose from the predefined values.static classValidateElement.RangeValidateElementIndicate that the value should fall within a certain range.static classValidateElement.RegexValidateElementIndicates that the value should be restricted to a regular expression.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidappendXML(XmlStringBuilder buf)Append XML.abstract voidcheckConsistency(FormField.Builder<?,?> formFieldBuilder)Check if this element is consistent according to the business rules in XEP-0122.protected voidcheckListRangeConsistency(FormField.Builder<?,?> formField)The >list-range/< element SHOULD be included only when the <field/> is of type "list-multi" and SHOULD be ignored otherwise.protected voidcheckNonMultiConsistency(FormField.Builder<?,?> formField, String method)Check that the field being build is not of type multi (or hidden).static ValidateElementfrom(FormField formField)StringgetDatatype()Specifies the data type of any value contained within theFormFieldelement.StringgetElementName()Returns the root element name.ValidateElement.ListRangegetListRange()Get list range.StringgetNamespace()Returns the root element XML namespace.QNamegetQName()booleanmustBeOnlyOfHisKind()voidsetListRange(ValidateElement.ListRange listRange)Set list range.XmlStringBuildertoXML(XmlEnvironment enclosingNamespace)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.smackx.xdata.FormFieldChildElement
isExclusiveElement, requiresNoTypeSet, validate
-
Methods inherited from interface org.jivesoftware.smack.packet.XmlElement
getLanguage
-
-
-
-
Field Detail
-
DATATYPE_XS_STRING
public static final String DATATYPE_XS_STRING
- See Also:
- Constant Field Values
-
ELEMENT
public static final String ELEMENT
- See Also:
- Constant Field Values
-
NAMESPACE
public static final String NAMESPACE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDatatype
public String getDatatype()
Specifies the data type of any value contained within theFormFieldelement. It MUST meet one of the following conditions:- Returns:
- the datatype
-
getElementName
public String getElementName()
Description copied from interface:NamedElementReturns the root element name.- Specified by:
getElementNamein interfaceNamedElement- Returns:
- the element name.
-
getNamespace
public String getNamespace()
Description copied from interface:XmlElementReturns the root element XML namespace.- Specified by:
getNamespacein interfaceXmlElement- Returns:
- the namespace.
-
getQName
public QName getQName()
- Specified by:
getQNamein interfaceXmlElement
-
mustBeOnlyOfHisKind
public final boolean mustBeOnlyOfHisKind()
- Specified by:
mustBeOnlyOfHisKindin interfaceFormFieldChildElement
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace)
-
appendXML
protected abstract void appendXML(XmlStringBuilder buf)
Append XML.- Parameters:
buf- TODO javadoc me please
-
setListRange
public void setListRange(ValidateElement.ListRange listRange)
Set list range.- Parameters:
listRange- the listRange to set
-
getListRange
public ValidateElement.ListRange getListRange()
Get list range.- Returns:
- the listRange
-
checkConsistency
public abstract void checkConsistency(FormField.Builder<?,?> formFieldBuilder)
Check if this element is consistent according to the business rules in XEP-0122.- Specified by:
checkConsistencyin interfaceFormFieldChildElement- Parameters:
formFieldBuilder- the builder used to construct the form field.
-
from
public static ValidateElement from(FormField formField)
-
checkListRangeConsistency
protected void checkListRangeConsistency(FormField.Builder<?,?> formField)
The >list-range/< element SHOULD be included only when the <field/> is of type "list-multi" and SHOULD be ignored otherwise.- Parameters:
formField- TODO javadoc me please
-
checkNonMultiConsistency
protected void checkNonMultiConsistency(FormField.Builder<?,?> formField, String method)
Check that the field being build is not of type multi (or hidden).- Parameters:
formField- TODO javadoc me pleasemethod- TODO javadoc me please
-
-