org.apache.commons.lang.BooleanUtils.toString()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(12.1k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.apache.commons.lang.BooleanUtils.toString()方法的一些代码示例,展示了BooleanUtils.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanUtils.toString()方法的具体详情如下:
包路径:org.apache.commons.lang.BooleanUtils
类名称:BooleanUtils
方法名:toString

BooleanUtils.toString介绍

[英]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;

[中]将布尔值转换为返回其中一个输入字符串的字符串。

BooleanUtils.toString(Boolean.TRUE, "true", "false", null)   = "true" 
BooleanUtils.toString(Boolean.FALSE, "true", "false", null)  = "false" 
BooleanUtils.toString(null, "true", "false", null)           = null;

代码示例

代码示例来源:origin: commons-lang/commons-lang

/**
 * <p>Converts a boolean to a String returning <code>'on'</code>
 * or <code>'off'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringOnOff(true)   = "on"
 *   BooleanUtils.toStringOnOff(false)  = "off"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'on'</code>, <code>'off'</code>,
 *  or <code>null</code>
 */
public static String toStringOnOff(boolean bool) {
  return toString(bool, "on", "off");
}

代码示例来源:origin: commons-lang/commons-lang

/**
 * <p>Converts a Boolean to a String returning <code>'yes'</code>,
 * <code>'no'</code>, or <code>null</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringYesNo(Boolean.TRUE)  = "yes"
 *   BooleanUtils.toStringYesNo(Boolean.FALSE) = "no"
 *   BooleanUtils.toStringYesNo(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'yes'</code>, <code>'no'</code>,
 *  or <code>null</code>
 */
public static String toStringYesNo(Boolean bool) {
  return toString(bool, "yes", "no", null);
}

代码示例来源:origin: commons-lang/commons-lang

/**
 * <p>Converts a boolean to a String returning <code>'true'</code>
 * or <code>'false'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringTrueFalse(true)   = "true"
 *   BooleanUtils.toStringTrueFalse(false)  = "false"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'true'</code>, <code>'false'</code>,
 *  or <code>null</code>
 */
public static String toStringTrueFalse(boolean bool) {
  return toString(bool, "true", "false");
}

代码示例来源:origin: commons-lang/commons-lang

/**
 * <p>Converts a Boolean to a String returning <code>'true'</code>,
 * <code>'false'</code>, or <code>null</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringTrueFalse(Boolean.TRUE)  = "true"
 *   BooleanUtils.toStringTrueFalse(Boolean.FALSE) = "false"
 *   BooleanUtils.toStringTrueFalse(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'true'</code>, <code>'false'</code>,
 *  or <code>null</code>
 */
public static String toStringTrueFalse(Boolean bool) {
  return toString(bool, "true", "false", null);
}

代码示例来源:origin: commons-lang/commons-lang

/**
 * <p>Converts a Boolean to a String returning <code>'on'</code>,
 * <code>'off'</code>, or <code>null</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringOnOff(Boolean.TRUE)  = "on"
 *   BooleanUtils.toStringOnOff(Boolean.FALSE) = "off"
 *   BooleanUtils.toStringOnOff(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'on'</code>, <code>'off'</code>,
 *  or <code>null</code>
 */
public static String toStringOnOff(Boolean bool) {
  return toString(bool, "on", "off", null);
}

代码示例来源:origin: commons-lang/commons-lang

/**
 * <p>Converts a boolean to a String returning <code>'yes'</code>
 * or <code>'no'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringYesNo(true)   = "yes"
 *   BooleanUtils.toStringYesNo(false)  = "no"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'yes'</code>, <code>'no'</code>,
 *  or <code>null</code>
 */
public static String toStringYesNo(boolean bool) {
  return toString(bool, "yes", "no");
}

代码示例来源:origin: org.osivia.services.directory.socle/osivia-services-directory-socle-implementations

/**
 * {@inheritDoc}
 */
@Override
public String convert(Boolean source) {
  return BooleanUtils.toString(source, "TRUE", "FALSE", null);
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * <p>Converts a boolean to a String returning <code>'yes'</code>
 * or <code>'no'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringYesNo(true)   = "yes"
 *   BooleanUtils.toStringYesNo(false)  = "no"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'yes'</code>, <code>'no'</code>,
 *  or <code>null</code>
 */
public static String toStringYesNo(boolean bool) {
  return toString(bool, "yes", "no");
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * <p>Converts a boolean to a String returning <code>'true'</code>
 * or <code>'false'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringTrueFalse(true)   = "true"
 *   BooleanUtils.toStringTrueFalse(false)  = "false"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'true'</code>, <code>'false'</code>,
 *  or <code>null</code>
 */
public static String toStringTrueFalse(boolean bool) {
  return toString(bool, "true", "false");
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * <p>Converts a boolean to a String returning <code>'true'</code>
 * or <code>'false'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringTrueFalse(true)   = "true"
 *   BooleanUtils.toStringTrueFalse(false)  = "false"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'true'</code>, <code>'false'</code>,
 *  or <code>null</code>
 */
public static String toStringTrueFalse(boolean bool) {
  return toString(bool, "true", "false");
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * <p>Converts a boolean to a String returning <code>'true'</code>
 * or <code>'false'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringTrueFalse(true)   = "true"
 *   BooleanUtils.toStringTrueFalse(false)  = "false"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'true'</code>, <code>'false'</code>,
 *  or <code>null</code>
 */
public static String toStringTrueFalse(boolean bool) {
  return toString(bool, "true", "false");
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * <p>Converts a boolean to a String returning <code>'on'</code>
 * or <code>'off'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringOnOff(true)   = "on"
 *   BooleanUtils.toStringOnOff(false)  = "off"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'on'</code>, <code>'off'</code>,
 *  or <code>null</code>
 */
public static String toStringOnOff(boolean bool) {
  return toString(bool, "on", "off");
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.lang

/**
 * <p>Converts a boolean to a String returning <code>'true'</code>
 * or <code>'false'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringTrueFalse(true)   = "true"
 *   BooleanUtils.toStringTrueFalse(false)  = "false"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'true'</code>, <code>'false'</code>,
 *  or <code>null</code>
 */
public static String toStringTrueFalse(boolean bool) {
  return toString(bool, "true", "false");
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * <p>Converts a Boolean to a String returning <code>'true'</code>,
 * <code>'false'</code>, or <code>null</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringTrueFalse(Boolean.TRUE)  = "true"
 *   BooleanUtils.toStringTrueFalse(Boolean.FALSE) = "false"
 *   BooleanUtils.toStringTrueFalse(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'true'</code>, <code>'false'</code>,
 *  or <code>null</code>
 */
public static String toStringTrueFalse(Boolean bool) {
  return toString(bool, "true", "false", null);
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * <p>Converts a Boolean to a String returning <code>'on'</code>,
 * <code>'off'</code>, or <code>null</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringOnOff(Boolean.TRUE)  = "on"
 *   BooleanUtils.toStringOnOff(Boolean.FALSE) = "off"
 *   BooleanUtils.toStringOnOff(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'on'</code>, <code>'off'</code>,
 *  or <code>null</code>
 */
public static String toStringOnOff(Boolean bool) {
  return toString(bool, "on", "off", null);
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * <p>Converts a boolean to a String returning <code>'yes'</code>
 * or <code>'no'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringYesNo(true)   = "yes"
 *   BooleanUtils.toStringYesNo(false)  = "no"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'yes'</code>, <code>'no'</code>,
 *  or <code>null</code>
 */
public static String toStringYesNo(boolean bool) {
  return toString(bool, "yes", "no");
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.commons.lang

/**
 * <p>Converts a boolean to a String returning <code>'yes'</code>
 * or <code>'no'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringYesNo(true)   = "yes"
 *   BooleanUtils.toStringYesNo(false)  = "no"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'yes'</code>, <code>'no'</code>,
 *  or <code>null</code>
 */
public static String toStringYesNo(boolean bool) {
  return toString(bool, "yes", "no");
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * <p>Converts a boolean to a String returning <code>'on'</code>
 * or <code>'off'</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringOnOff(true)   = "on"
 *   BooleanUtils.toStringOnOff(false)  = "off"
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'on'</code>, <code>'off'</code>,
 *  or <code>null</code>
 */
public static String toStringOnOff(boolean bool) {
  return toString(bool, "on", "off");
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.lang

/**
 * <p>Converts a Boolean to a String returning <code>'true'</code>,
 * <code>'false'</code>, or <code>null</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringTrueFalse(Boolean.TRUE)  = "true"
 *   BooleanUtils.toStringTrueFalse(Boolean.FALSE) = "false"
 *   BooleanUtils.toStringTrueFalse(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'true'</code>, <code>'false'</code>,
 *  or <code>null</code>
 */
public static String toStringTrueFalse(Boolean bool) {
  return toString(bool, "true", "false", null);
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.lang

/**
 * <p>Converts a Boolean to a String returning <code>'on'</code>,
 * <code>'off'</code>, or <code>null</code>.</p>
 * 
 * <pre>
 *   BooleanUtils.toStringOnOff(Boolean.TRUE)  = "on"
 *   BooleanUtils.toStringOnOff(Boolean.FALSE) = "off"
 *   BooleanUtils.toStringOnOff(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to check
 * @return <code>'on'</code>, <code>'off'</code>,
 *  or <code>null</code>
 */
public static String toStringOnOff(Boolean bool) {
  return toString(bool, "on", "off", null);
}

相关文章