Search in sources :

Example 1 with AbstractSingleStringValueFormField

use of org.jivesoftware.smackx.xdata.AbstractSingleStringValueFormField in project Smack by igniterealtime.

the class FormReader method readInteger.

default Integer readInteger(String fieldName) {
    FormField formField = getField(fieldName);
    if (formField == null) {
        return null;
    }
    AbstractSingleStringValueFormField textSingleFormField = formField.ifPossibleAs(AbstractSingleStringValueFormField.class);
    return textSingleFormField.getValueAsInt();
}
Also used : AbstractSingleStringValueFormField(org.jivesoftware.smackx.xdata.AbstractSingleStringValueFormField) FormField(org.jivesoftware.smackx.xdata.FormField) AbstractSingleStringValueFormField(org.jivesoftware.smackx.xdata.AbstractSingleStringValueFormField) AbstractMultiFormField(org.jivesoftware.smackx.xdata.AbstractMultiFormField) BooleanFormField(org.jivesoftware.smackx.xdata.BooleanFormField)

Example 2 with AbstractSingleStringValueFormField

use of org.jivesoftware.smackx.xdata.AbstractSingleStringValueFormField in project Smack by igniterealtime.

the class FormReader method readDate.

default Date readDate(String fieldName) throws ParseException {
    FormField formField = getField(fieldName);
    if (formField == null) {
        return null;
    }
    AbstractSingleStringValueFormField textSingleFormField = formField.ifPossibleAs(AbstractSingleStringValueFormField.class);
    String value = textSingleFormField.getValue();
    if (value == null) {
        return null;
    }
    return XmppDateTime.parseDate(value);
}
Also used : AbstractSingleStringValueFormField(org.jivesoftware.smackx.xdata.AbstractSingleStringValueFormField) FormField(org.jivesoftware.smackx.xdata.FormField) AbstractSingleStringValueFormField(org.jivesoftware.smackx.xdata.AbstractSingleStringValueFormField) AbstractMultiFormField(org.jivesoftware.smackx.xdata.AbstractMultiFormField) BooleanFormField(org.jivesoftware.smackx.xdata.BooleanFormField)

Aggregations

AbstractMultiFormField (org.jivesoftware.smackx.xdata.AbstractMultiFormField)2 AbstractSingleStringValueFormField (org.jivesoftware.smackx.xdata.AbstractSingleStringValueFormField)2 BooleanFormField (org.jivesoftware.smackx.xdata.BooleanFormField)2 FormField (org.jivesoftware.smackx.xdata.FormField)2