aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/xmpp
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-01-23 20:32:00 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-01-23 20:32:00 +0100
commit8850a1fbe3d8affd734b94eb0eb650dc1dfa5bd6 (patch)
treed91abd8a444bc371b57bd852068f3a5b8ba98f2f /src/main/java/eu/siacs/conversations/xmpp
parent0569a1e7698141262e3f8443be26b5cb053954b8 (diff)
added FormWrapper and form field validation
Diffstat (limited to 'src/main/java/eu/siacs/conversations/xmpp')
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/forms/Field.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java
index c1fc808dc..020b34b90 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/forms/Field.java
@@ -1,7 +1,9 @@
package eu.siacs.conversations.xmpp.forms;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import eu.siacs.conversations.xml.Element;
@@ -52,6 +54,19 @@ public class Field extends Element {
return findChildContent("value");
}
+ public List<String> getValues() {
+ List<String> values = new ArrayList<>();
+ for(Element child : getChildren()) {
+ if ("value".equals(child.getName())) {
+ String content = child.getContent();
+ if (content != null) {
+ values.add(content);
+ }
+ }
+ }
+ return values;
+ }
+
public String getLabel() {
return getAttribute("label");
}