1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-09 22:51:07 +01:00

Remove ValidateElement.EmptyValidateElement

because it has the same semantic as BasicValidateElement.
This commit is contained in:
Florian Schmaus 2015-01-04 22:17:02 +01:00
parent c770b12348
commit d78b39d117
3 changed files with 9 additions and 33 deletions

View file

@ -117,32 +117,6 @@ public abstract class ValidateElement implements PacketExtension {
*/
public abstract void checkConsistency(FormField formField);
/**
*
* This defines the empty validate element that does only specify a 'datatype' attribute.
*
*/
public static class EmptyValidateElement extends ValidateElement {
/**
* @param dataType
* @see #getDatatype()
*/
public EmptyValidateElement(String dataType) {
super(dataType);
}
@Override
protected void appendXML(XmlStringBuilder buf) {
// The empty validate element does not contain any further elements or text, it is empty.
}
@Override
public void checkConsistency(FormField formField) {
// Since we can't know all possible datatypes, we can not perform any validation here
}
}
/**
* Validation only against the datatype itself. Indicates that the value(s) should simply match the field type and
* datatype constraints.

View file

@ -22,7 +22,6 @@ import java.util.logging.Logger;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement;
import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement.BasicValidateElement;
import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement.EmptyValidateElement;
import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement.ListRange;
import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement.OpenValidateElement;
import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement.RangeValidateElement;
@ -81,7 +80,9 @@ public class DataValidationProvider {
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
if (dataValidation == null) {
dataValidation = new EmptyValidateElement(dataType);
// XEP-122 § 3.2 states that "If no validation method is specified,
// form processors MUST assume <basic/> validation."
dataValidation = new BasicValidateElement(dataType);
}
dataValidation.setListRange(listRange);
break outerloop;