aQute.bnd.build.model.conversions.DefaultBooleanFormatter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biz.aQute.bndlib Show documentation
Show all versions of biz.aQute.bndlib Show documentation
bndlib: A Swiss Army Knife for OSGi
The newest version!
package aQute.bnd.build.model.conversions;
/**
* Formatter for booleans with a default value; if the input value matches the
* default then it is formatted to null
.
*
* @author Neil Bartlett
*/
public class DefaultBooleanFormatter implements Converter {
private final boolean defaultValue;
public DefaultBooleanFormatter(boolean defaultValue) {
this.defaultValue = defaultValue;
}
@Override
public String convert(Boolean input) throws IllegalArgumentException {
String result = null;
if (input != null && input.booleanValue() != defaultValue)
result = input.toString();
return result;
}
@Override
public String error(String msg) {
return msg;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy