diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/BooleanFormField.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/BooleanFormField.java index 6208e4979..6681e6408 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/BooleanFormField.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/BooleanFormField.java @@ -49,6 +49,20 @@ public class BooleanFormField extends SingleValueFormField { return value; } + /** + * Get the value of the boolean field or maybe null. Note that you usually want to use + * {@link #getValueAsBoolean()} instead of this method, as {@link #getValueAsBoolean()} considers the default value + * of boolean fields. That is, boolean form fields have the value false if not explicitly set to + * something else. + * + * @return the boolean value of this form field or null if no value was explicitly provided. + * @see #getValueAsBoolean() + * @since 4.4.5 + */ + public Boolean getValueAsBooleanOrNull() { + return value; + } + public Builder asBuilder() { return new Builder(this); }