Java Code Examples for org.jivesoftware.smackx.xdata.FormField#Value
The following examples show how to use
org.jivesoftware.smackx.xdata.FormField#Value .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataFormProvider.java From Smack with Apache License 2.0 | 5 votes |
private static FormField.Builder<?, ?> parseBooleanFormField(String fieldName, List<FormField.Value> values) throws SmackParsingException { BooleanFormField.Builder builder = FormField.booleanBuilder(fieldName); if (values.size() == 1) { String value = values.get(0).getValue().toString(); builder.setValue(value); } return builder; }
Example 2
Source File: DataFormProvider.java From Smack with Apache License 2.0 | 5 votes |
private static AbstractSingleStringValueFormField.Builder<?, ?> parseSingleKindFormField( AbstractSingleStringValueFormField.Builder<?, ?> builder, List<FormField.Value> values) throws SmackParsingException { ensureAtMostSingleValue(builder.getType(), values); if (values.size() == 1) { String value = values.get(0).getValue().toString(); builder.setValue(value); } return builder; }
Example 3
Source File: DataFormProvider.java From Smack with Apache License 2.0 | 5 votes |
private static AbstractMultiFormField.Builder<?, ?> parseMultiKindFormField(AbstractMultiFormField.Builder<?, ?> builder, List<FormField.Value> values) { for (FormField.Value value : values) { builder.addValue(value.getValue()); } return builder; }
Example 4
Source File: DataFormProvider.java From Smack with Apache License 2.0 | 4 votes |
public static FormField.Value parseValue(XmlPullParser parser) throws IOException, XmlPullParserException { String value = parser.nextText(); return new FormField.Value(value); }
Example 5
Source File: DataFormProvider.java From Smack with Apache License 2.0 | 4 votes |
private static void ensureAtMostSingleValue(FormField.Type type, List<FormField.Value> values) throws SmackParsingException { if (values.size() > 1) { throw new SmackParsingException(type + " fields can have at most one value, this one had " + values.size()); } }