diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-01-23 20:32:00 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-01-23 20:32:00 +0100 |
commit | 8850a1fbe3d8affd734b94eb0eb650dc1dfa5bd6 (patch) | |
tree | d91abd8a444bc371b57bd852068f3a5b8ba98f2f /src/main/java/eu/siacs/conversations/xmpp/forms/Field.java | |
parent | 0569a1e7698141262e3f8443be26b5cb053954b8 (diff) |
added FormWrapper and form field validation
Diffstat (limited to 'src/main/java/eu/siacs/conversations/xmpp/forms/Field.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/forms/Field.java | 15 |
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 c1fc808d..020b34b9 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"); } |