Class ValidateElement
- java.lang.Object
-
- org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement
-
- All Implemented Interfaces:
Element
,FullyQualifiedElement
,NamedElement
,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 aFormField
in 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 class
ValidateElement.BasicValidateElement
Validation only against the datatype itself.static class
ValidateElement.ListRange
This element indicates for "list-multi", that a minimum and maximum number of options should be selected and/or entered.static class
ValidateElement.OpenValidateElement
For "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 class
ValidateElement.RangeValidateElement
Indicate that the value should fall within a certain range.static class
ValidateElement.RegexValidateElement
Indicates 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 void
appendXML(XmlStringBuilder buf)
abstract void
checkConsistency(FormField.Builder<?,?> formFieldBuilder)
Check if this element is consistent according to the business rules in XEP-0122.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.protected void
checkNonMultiConsistency(FormField.Builder<?,?> formField, String method)
static ValidateElement
from(FormField formField)
String
getDatatype()
Specifies the data type of any value contained within theFormField
element.String
getElementName()
Returns the root element name.ValidateElement.ListRange
getListRange()
Get list range.String
getNamespace()
Returns the root element XML namespace.QName
getQName()
boolean
mustBeOnlyOfHisKind()
void
setListRange(ValidateElement.ListRange listRange)
Set list range.XmlStringBuilder
toXML(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.FullyQualifiedElement
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 theFormField
element. It MUST meet one of the following conditions:- Returns:
- the datatype
-
getElementName
public String getElementName()
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
getNamespace
public String getNamespace()
Description copied from interface:FullyQualifiedElement
Returns the root element XML namespace.- Specified by:
getNamespace
in interfaceFullyQualifiedElement
- Returns:
- the namespace.
-
getQName
public QName getQName()
- Specified by:
getQName
in interfaceFullyQualifiedElement
-
mustBeOnlyOfHisKind
public final boolean mustBeOnlyOfHisKind()
- Specified by:
mustBeOnlyOfHisKind
in interfaceFormFieldChildElement
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace)
-
appendXML
protected abstract void appendXML(XmlStringBuilder buf)
- 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:
checkConsistency
in 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)
- Parameters:
formField
- TODO javadoc me pleasemethod
- TODO javadoc me please
-
-