Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,19 @@ public DataResult<Number> getNumberValue(final ConfigurationNode input) {
return DataResult.error(() -> "Not a number: " + input);
}

/**
* Get the value of the provided node if it is a boolean or a number where non-zero is {@code true}.
*
* @param input data source
* @return extracted boolean
*/
@Override
public DataResult<Boolean> getBooleanValue(final ConfigurationNode input) {
return getNumberValue(input)
.map(number -> number.doubleValue() != 0.0)
.mapError(_ -> "Not a boolean: " + input);
}

/**
* Get the value of the provided node if it is a scalar, converted to
* a {@link String}.
Expand Down