diff options
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Field.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Field.java | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Field.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Field.java deleted file mode 100644 index 88b3155c..00000000 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/forms/Field.java +++ /dev/null @@ -1,81 +0,0 @@ -package de.thedevstack.conversationsplus.xmpp.forms; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import de.thedevstack.conversationsplus.xml.Element; - -public class Field extends Element { - - public Field(String name) { - super("field"); - this.setAttribute("var",name); - } - - private Field() { - super("field"); - } - - public String getFieldName() { - return this.getAttribute("var"); - } - - public void setValue(String value) { - this.children.clear(); - this.addChild("value").setContent(value); - } - - public void setValues(Collection<String> values) { - this.children.clear(); - for(String value : values) { - this.addChild("value").setContent(value); - } - } - - public void removeNonValueChildren() { - for(Iterator<Element> iterator = this.children.iterator(); iterator.hasNext();) { - Element element = iterator.next(); - if (!element.getName().equals("value")) { - iterator.remove(); - } - } - } - - public static Field parse(Element element) { - Field field = new Field(); - field.setAttributes(element.getAttributes()); - field.setChildren(element.getChildren()); - return field; - } - - public String getValue() { - 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"); - } - - public String getType() { - return getAttribute("type"); - } - - public boolean isRequired() { - return hasChild("required"); - } -} |