org.apache.commons.lang3.BooleanUtils类方法分析

方法签名功能或适用场景入参详细解释
public static boolean and(final boolean... array) 对一组boolean值进行与操作
  • array: 一组boolean值
public static Boolean and(final Boolean... array) 对一组Boolean对象进行与操作
  • array: 一组Boolean对象
public static boolean or(final boolean... array) 对一组boolean值进行或操作
  • array: 一组boolean值
public static Boolean or(final Boolean... array) 对一组Boolean对象进行或操作
  • array: 一组Boolean对象
public static boolean xor(final boolean... array) 对一组boolean值进行异或操作
  • array: 一组boolean值
public static Boolean xor(final Boolean... array) 对一组Boolean对象进行异或操作
  • array: 一组Boolean对象
public static boolean toBoolean(final Boolean bool) 将Boolean对象转换为boolean值
  • bool: 要转换的Boolean对象
public static boolean toBoolean(final int value) 将int值转换为boolean值,非零为true,零���false
  • value: 要转换的int值
public static boolean toBoolean(final int value, final int trueValue, final int falseValue) 将int值转换为boolean值,指定true和false的匹配值
  • value: 要转换的int值
  • trueValue: 匹配true的值
  • falseValue: 匹配false的值
public static boolean toBoolean(final Integer value, final Integer trueValue, final Integer falseValue) 将Integer对象转换为boolean值,指定true和false的匹配值
  • value: 要转换的Integer对象
  • trueValue: 匹配true的值
  • falseValue: 匹配false的值
public static boolean toBoolean(final String str) 将String对象转换为boolean值,支持多种true和false的字符串表示
  • str: 要转换的String对象
public static boolean toBoolean(final String str, final String trueString, final String falseString) 将String对象转换为boolean值,指定true和false的匹配字符串
  • str: 要转换的String对象
  • trueString: 匹配true的字符串
  • falseString: 匹配false的字符串
public static boolean toBooleanDefaultIfNull(final Boolean bool, final boolean valueIfNull) 将Boolean对象转换为boolean值,如果为null则返回指定的默认值
  • bool: 要转换的Boolean对象
  • valueIfNull: 如果bool为null时返回的默认值
public static Boolean toBooleanObject(final int value) 将int值转换为Boolean对象,非零为Boolean.TRUE,零为Boolean.FALSE
  • value: 要转换的int值
public static Boolean toBooleanObject(final int value, final int trueValue, final int falseValue, final int nullValue) 将int值转换为Boolean对象,指定true、false和null的匹配值
  • value: 要转换的int值
  • trueValue: 匹配true的值
  • falseValue: 匹配false的值
  • nullValue: 匹配null的值
public static Boolean toBooleanObject(final Integer value) 将Integer对象转换为Boolean对象,非零为Boolean.TRUE,零为Boolean.FALSE
  • value: 要转换的Integer对象
public static Boolean toBooleanObject(final Integer value, final Integer trueValue, final Integer falseValue, final Integer nullValue) 将Integer对象转换为Boolean对象,指定true、false和null的匹配值
  • value: 要转换的Integer对象
  • trueValue: 匹配true的值
  • falseValue: 匹配false���值
  • nullValue: 匹配null的值
public static Boolean toBooleanObject(final String str) 将String对象转换为Boolean对象,支持多种true和false的字符串表示
  • str: 要转换的String对象
public static Boolean toBooleanObject(final String str, final String trueString, final String falseString, final String nullString) 将String对象转换为Boolean对象,指定true、false和null的匹配字符串
  • str: 要转换的String对象
  • trueString: 匹配true的字符串
  • falseString: 匹配false的字符串
  • nullString: 匹配null的字符串
public static int toInteger(final boolean bool) 将boolean值转��为int值,true为1,false为0
  • bool: 要转换的boolean值
public static int toInteger(final boolean bool, final int trueValue, final int falseValue) 将boolean值转换为int值,指定true和false的匹配值
  • bool: 要转换的boolean值
  • trueValue: 匹配true的值
  • falseValue: 匹配false的值
public static int toInteger(final Boolean bool, final int trueValue, final int falseValue, final int nullValue) 将Boolean对象转换为int值,指定true、false和null的匹配值
  • bool: 要转换的Boolean对象
  • trueValue: 匹配true的值
  • falseValue: 匹配false的值
  • nullValue: 匹配null的值
public static Integer toIntegerObject(final boolean bool) 将boolean值转换为Integer对象,true为Integer.valueOf(1),false为Integer.valueOf(0)
  • bool: 要转换的boolean值
public static Integer toIntegerObject(final boolean bool, final Integer trueValue, final Integer falseValue) 将boolean值转换为Integer对象,指定true和false的匹配值
  • bool: 要转换的boolean值
  • trueValue: 匹配true的值
  • falseValue: 匹配false的值
public static Integer toIntegerObject(final Boolean bool) 将Boolean对象转换为Integer对象,true为Integer.valueOf(1),false为Integer.valueOf(0)
  • bool: 要转换的Boolean对象
public static Integer toIntegerObject(final Boolean bool, final Integer trueValue, final Integer falseValue, final Integer nullValue) 将Boolean对象转换为Integer对象,指定true、false和null的匹配值
  • bool: 要转换的Boolean对象
  • trueValue: 匹配true的值
  • falseValue: 匹配false的值
  • nullValue: 匹配null的值
public static String toString(final Boolean bool, final String trueString, final String falseString, final String nullString) 将Boolean对象转换为String对象,指定true、false和null的匹配字符串
  • bool: 要转换的Boolean对象
  • trueString: 匹配true的字符串
  • falseString: 匹配false的字符串
  • nullString: 匹配null的字符串
public static String toString(final boolean bool, final String trueString, final String falseString) 将boolean值转换为String对象,指定true和false的匹配字符串
  • bool: 要转换的boolean值
  • trueString: 匹配true的字符串
  • falseString: 匹配false的字符串
public static String toStringOnOff(final Boolean bool) 将Boolean对象转换为"on"或"off"字符串
  • bool: 要转换的Boolean对象
public static String toStringOnOff(final boolean bool) 将boolean值转换为"on"或"off"字符串
  • bool: 要转换的boolean值
public static String toStringTrueFalse(final Boolean bool) 将Boolean对象转换为"true"或"false"字符串
  • bool: 要转换的Boolean对象
public static String toStringTrueFalse(final boolean bool) 将boolean值转换为"true"或"false"字符串
  • bool: 要转换的boolean值
public static String toStringYesNo(final Boolean bool) 将Boolean对象转换为"yes"或"no"字符串
  • bool: 要转换的Boolean对象
public static String toStringYesNo(final boolean bool) 将boolean值转换为"yes"或"no"字符串
  • bool: 要转换的boolean值
posted on 2024-10-11 15:10  卡米i  阅读(39)  评论(0)    收藏  举报