Class ValidateElement

java.lang.Object
org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement
All Implemented Interfaces:
org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.XmlElement, org.jivesoftware.smack.packet.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 a FormField in a DataForm, such as validation of standard XML datatypes, application-specific datatypes, value ranges, and regular expressions.
  • Field Details

  • Method Details

    • getDatatype

      public String getDatatype()
      Specifies the data type of any value contained within the FormField element. It MUST meet one of the following conditions:
      • Start with "xs:", and be one of the "built-in" datatypes defined in XML Schema Part 2 [2]
      • Start with a prefix registered with the XMPP Registrar [3]
      • Start with "x:", and specify a user-defined datatype [4]
      Returns:
      the datatype
    • getElementName

      public String getElementName()
      Specified by:
      getElementName in interface org.jivesoftware.smack.packet.NamedElement
    • getNamespace

      public String getNamespace()
      Specified by:
      getNamespace in interface org.jivesoftware.smack.packet.XmlElement
    • getQName

      public QName getQName()
      Specified by:
      getQName in interface org.jivesoftware.smack.packet.XmlElement
    • mustBeOnlyOfHisKind

      public final boolean mustBeOnlyOfHisKind()
      Specified by:
      mustBeOnlyOfHisKind in interface FormFieldChildElement
    • toXML

      public org.jivesoftware.smack.util.XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
      Specified by:
      toXML in interface org.jivesoftware.smack.packet.Element
    • appendXML

      protected abstract void appendXML(org.jivesoftware.smack.util.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:
      checkConsistency in interface FormFieldChildElement
      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 please
      method - TODO javadoc me please