Commit Graph

4 Commits

Author SHA1 Message Date
Florian Schmaus 5c46451cd2 [xdata] Add BooleanFormField.getValueAsBooleanOrNull()
This method is meant to provide 'raw' access to what has been sent
over the wire. It is assumed to be not of much use in the typically
case, but provided for completeness.
2021-12-27 21:24:19 +01:00
Florian Schmaus 940d7bf02a [xdata] Adjust behavior of BooleanFormField.getValueAsBoolean()
According to XEP-0004 § 3.3, the default value of a boolean form field
is 'false'. And since users are typically interested in getting the
value, and not potentially 'null' as result, we adjust the behavior of
the getValueAsBoolean() method consider the default value.
2021-12-27 21:17:57 +01:00
Florian Schmaus e626580f68 [xdata] Safe the raw character data of form field values
Related to SMACK-909.
2021-07-19 15:38:42 +02:00
Florian Schmaus 77e26fc575 Re-work data form API
Apply builder pattern to form fields and replace getVariable() with
getFieldName(). Refer to the field name as "field name" instead of
"variable" everyone, just as XEP-0004 does.

Improve the high-level form API: introduce FilledForm and FillableForm
which perform stronger validation and consistency checks.

Also add FormFieldRegistry to enable processing of 'submit' forms
where the form field types are omitted.

Smack also now does omit the form field type declaration on 'submit'
type forms, as it is allowed by XEP-0004.
2020-05-13 20:14:41 +02:00