Java org.apache.commons.lang BooleanUtils fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.lang BooleanUtils fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.lang BooleanUtils.

The text is from its open source code.

Subclass

org.apache.commons.lang.BooleanUtils has subclasses.
Click this link to see all its subclasses.

Method

booleanisFalse(Boolean bool)

Checks if a Boolean value is false, handling null by returning false.

 BooleanUtils.isFalse(Boolean.TRUE)  = false BooleanUtils.isFalse(Boolean.FALSE) = true BooleanUtils.isFalse(null)          = false 
booleanisNotFalse(Boolean bool)

Checks if a Boolean value is not false, handling null by returning true.

 BooleanUtils.isNotFalse(Boolean.TRUE)  = true BooleanUtils.isNotFalse(Boolean.FALSE) = false BooleanUtils.isNotFalse(null)          = true 
booleanisNotTrue(Boolean bool)

Checks if a Boolean value is not true, handling null by returning true.

 BooleanUtils.isNotTrue(Boolean.TRUE)  = false BooleanUtils.isNotTrue(Boolean.FALSE) = true BooleanUtils.isNotTrue(null)          = true 
booleanisTrue(Boolean bool)

Checks if a Boolean value is true, handling null by returning false.

 BooleanUtils.isTrue(Boolean.TRUE)  = true BooleanUtils.isTrue(Boolean.FALSE) = false BooleanUtils.isTrue(null)          = false 
Booleannegate(Boolean bool)

Negates the specified boolean.

If null is passed in, null will be returned.

 BooleanUtils.negate(Boolean.TRUE)  = Boolean.FALSE; BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE; BooleanUtils.negate(null)          = null; 
booleantoBoolean(Boolean bool)

Converts a Boolean to a boolean handling null by returning false.

 BooleanUtils.toBoolean(Boolean.TRUE)  = true BooleanUtils.toBoolean(Boolean.FALSE) = false BooleanUtils.toBoolean(null)          = false 
booleantoBoolean(int value)

Converts an int to a boolean using the convention that zero is false.

 BooleanUtils.toBoolean(0) = false BooleanUtils.toBoolean(1) = true BooleanUtils.toBoolean(2) = true 
booleantoBoolean(String str)

Converts a String to a boolean (optimised for performance).

'true', 'on' or 'yes' (case insensitive) will return true.

booleantoBoolean(int value, int trueValue, int falseValue)

Converts an int to a boolean specifying the conversion values.

 BooleanUtils.toBoolean(0, 1, 0) = false BooleanUtils.toBoolean(1, 1, 0) = true BooleanUtils.toBoolean(2, 1, 2) = false BooleanUtils.toBoolean(2, 2, 0) = true 
booleantoBoolean(Integer value, Integer trueValue, Integer falseValue)

Converts an Integer to a boolean specifying the conversion values.

 BooleanUtils.toBoolean(new Integer(0), new Integer(1), new Integer(0)) = false BooleanUtils.toBoolean(new Integer(1), new Integer(1), new Integer(0)) = true BooleanUtils.toBoolean(new Integer(2), new Integer(1), new Integer(2)) = false BooleanUtils.toBoolean(new Integer(2), new Integer(2), new Integer(0)) = true BooleanUtils.toBoolean(null, null, new Integer(0))                     = true 
booleantoBoolean(String str, String trueString, String falseString)

Converts a String to a Boolean throwing an exception if no match found.

null is returned if there is no match.

 BooleanUtils.toBoolean("true", "true", "false")  = true BooleanUtils.toBoolean("false", "true", "false") = false 
booleantoBooleanDefaultIfNull(Boolean bool, boolean valueIfNull)

Converts a Boolean to a boolean handling null.

 BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE, false) = true BooleanUtils.toBooleanDefaultIfNull(Boolean.FALSE, true) = false BooleanUtils.toBooleanDefaultIfNull(null, true)          = true 
BooleantoBooleanObject(boolean bool)

Boolean factory that avoids creating new Boolean objecs all the time.

This method was added to JDK1.4 but is available here for earlier JDKs.

 BooleanUtils.toBooleanObject(false) = Boolean.FALSE BooleanUtils.toBooleanObject(true)  = Boolean.TRUE 
BooleantoBooleanObject(int value)

Converts an int to a Boolean using the convention that zero is false.

 BooleanUtils.toBoolean(0) = Boolean.FALSE BooleanUtils.toBoolean(1) = Boolean.TRUE BooleanUtils.toBoolean(2) = Boolean.TRUE 
BooleantoBooleanObject(Integer value)

Converts an Integer to a Boolean using the convention that zero is false.

null will be converted to null.

 BooleanUtils.toBoolean(new Integer(0))    = Boolean.FALSE BooleanUtils.toBoolean(new Integer(1))    = Boolean.TRUE BooleanUtils.toBoolean(new Integer(null)) = null 
BooleantoBooleanObject(String str)

Converts a String to a Boolean.

'true', 'on' or 'yes' (case insensitive) will return true.

BooleantoBooleanObject(int value, int trueValue, int falseValue, int nullValue)

Converts an int to a Boolean specifying the conversion values.

 BooleanUtils.toBooleanObject(0, 0, 2, 3) = Boolean.TRUE BooleanUtils.toBooleanObject(2, 1, 2, 3) = Boolean.FALSE BooleanUtils.toBooleanObject(3, 1, 2, 3) = null 
BooleantoBooleanObject(Integer value, Integer trueValue, Integer falseValue, Integer nullValue)

Converts an Integer to a Boolean specifying the conversion values.

 BooleanUtils.toBooleanObject(new Integer(0), new Integer(0), new Integer(2), new Integer(3)) = Boolean.TRUE BooleanUtils.toBooleanObject(new Integer(2), new Integer(1), new Integer(2), new Integer(3)) = Boolean.FALSE BooleanUtils.toBooleanObject(new Integer(3), new Integer(1), new Integer(2), new Integer(3)) = null 
BooleantoBooleanObject(String str, String trueString, String falseString, String nullString)

Converts a String to a Boolean throwing an exception if no match.

 BooleanUtils.toBooleanObject("true", "true", "false", "null")  = Boolean.TRUE BooleanUtils.toBooleanObject("false", "true", "false", "null") = Boolean.FALSE BooleanUtils.toBooleanObject("null", "true", "false", "null")  = null 
inttoInteger(boolean bool)

Converts a boolean to an int using the convention that zero is false.

 BooleanUtils.toInteger(true)  = 1 BooleanUtils.toInteger(false) = 0 
inttoInteger(Boolean bool, int trueValue, int falseValue, int nullValue)

Converts a Boolean to an int specifying the conversion values.

 BooleanUtils.toInteger(Boolean.TRUE, 1, 0, 2)  = 1 BooleanUtils.toInteger(Boolean.FALSE, 1, 0, 2) = 0 BooleanUtils.toInteger(null, 1, 0, 2)          = 2 
IntegertoIntegerObject(boolean bool)

Converts a boolean to an Integer using the convention that zero is false.

 BooleanUtils.toIntegerObject(true)  = new Integer(1) BooleanUtils.toIntegerObject(false) = new Integer(0) 
IntegertoIntegerObject(Boolean bool)

Converts a Boolean to a Integer using the convention that zero is false.

null will be converted to null.

 BooleanUtils.toIntegerObject(Boolean.TRUE)  = new Integer(1) BooleanUtils.toIntegerObject(Boolean.FALSE) = new Integer(0) 
StringtoString(Boolean bool, String trueString, String falseString, String nullString)

Converts a Boolean to a String returning one of the input Strings.

 BooleanUtils.toString(Boolean.TRUE, "true", "false", null)   = "true" BooleanUtils.toString(Boolean.FALSE, "true", "false", null)  = "false" BooleanUtils.toString(null, "true", "false", null)           = null; 
StringtoString(boolean bool, String trueString, String falseString)

Converts a boolean to a String returning one of the input Strings.

 BooleanUtils.toString(true, "true", "false")   = "true" BooleanUtils.toString(false, "true", "false")  = "false" 
StringtoStringTrueFalse(Boolean bool)

Converts a Boolean to a String returning 'true', 'false', or null.

 BooleanUtils.toStringTrueFalse(Boolean.TRUE)  = "true" BooleanUtils.toStringTrueFalse(Boolean.FALSE) = "false" BooleanUtils.toStringTrueFalse(null)          = null; 
StringtoStringTrueFalse(boolean bool)

Converts a boolean to a String returning 'true' or 'false'.

 BooleanUtils.toStringTrueFalse(true)   = "true" BooleanUtils.toStringTrueFalse(false)  = "false" 
StringtoStringYesNo(Boolean bool)

Converts a Boolean to a String returning 'yes', 'no', or null.

 BooleanUtils.toStringYesNo(Boolean.TRUE)  = "yes" BooleanUtils.toStringYesNo(Boolean.FALSE) = "no" BooleanUtils.toStringYesNo(null)          = null; 
StringtoStringYesNo(boolean bool)

Converts a boolean to a String returning 'yes' or 'no'.

 BooleanUtils.toStringYesNo(true)   = "yes" BooleanUtils.toStringYesNo(false)  = "no" 
booleanxor(boolean[] array)

Performs an xor on a set of booleans.

 BooleanUtils.xor(new boolean[] { true, true })   = false BooleanUtils.xor(new boolean[] { false, false }) = false BooleanUtils.xor(new boolean[] { true, false })  = true 
Booleanxor(Boolean[] array)

Performs an xor on an array of Booleans.

 BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE })   = Boolean.FALSE BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE })  = Boolean.TRUE