Java Code Examples for org.jivesoftware.smackx.xdata.FormField#hiddenBuilder()

The following examples show how to use org.jivesoftware.smackx.xdata.FormField#hiddenBuilder() . 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: FillableForm.java    From Smack with Apache License 2.0 5 votes vote down vote up
private static AbstractSingleStringValueFormField.Builder<?, ?> createSingleKindFieldBuilder(String fieldName, FormField.Type type) {
    switch (type) {
    case text_private:
        return FormField.textPrivateBuilder(fieldName);
    case text_single:
        return FormField.textSingleBuilder(fieldName);
    case hidden:
        return FormField.hiddenBuilder(fieldName);
    case list_multi:
        return FormField.listSingleBuilder(fieldName);
    default:
        throw new IllegalArgumentException();
    }
}
 
Example 2
Source File: DataValidationHelperTest.java    From Smack with Apache License 2.0 5 votes vote down vote up
@Test
public void testCheckConsistencyFormFieldOpenValidateElement() {
    FormField.Builder<?, ?> field = FormField.hiddenBuilder("var");
    OpenValidateElement element = new OpenValidateElement(null);
    ValidationConsistencyException e = assertThrows(ValidationConsistencyException.class,
                    () -> element.checkConsistency(field));
    assertEquals("Field type 'hidden' is not consistent with validation method 'open'.", e.getMessage());
}