下面列出了org.apache.commons.lang3.math.NumberUtils#INTEGER_ZERO 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* <p>Converts a Boolean to a Integer using the convention that
* <code>zero</code> is <code>false</code>.</p>
*
* <p><code>null</code> will be converted to <code>null</code>.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(Boolean.TRUE) = new Integer(1)
* BooleanUtils.toIntegerObject(Boolean.FALSE) = new Integer(0)
* </pre>
*
* @param bool the Boolean to convert
* @return one if Boolean.TRUE, zero if Boolean.FALSE, <code>null</code> if <code>null</code>
*/
public static Integer toIntegerObject(Boolean bool) {
if (bool == null) {
return null;
}
return bool.booleanValue() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
/**
* <p>Converts a Boolean to a Integer using the convention that
* {@code zero} is {@code false}.</p>
*
* <p>{@code null} will be converted to {@code null}.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(Boolean.TRUE) = Integer.valueOf(1)
* BooleanUtils.toIntegerObject(Boolean.FALSE) = Integer.valueOf(0)
* </pre>
*
* @param bool the Boolean to convert
* @return one if Boolean.TRUE, zero if Boolean.FALSE, {@code null} if {@code null}
*/
public static Integer toIntegerObject(Boolean bool) {
if (bool == null) {
return null;
}
return bool.booleanValue() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
/**
* <p>Converts a Boolean to a Integer using the convention that
* <code>zero</code> is <code>false</code>.</p>
*
* <p><code>null</code> will be converted to <code>null</code>.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(Boolean.TRUE) = new Integer(1)
* BooleanUtils.toIntegerObject(Boolean.FALSE) = new Integer(0)
* </pre>
*
* @param bool the Boolean to convert
* @return one if Boolean.TRUE, zero if Boolean.FALSE, <code>null</code> if <code>null</code>
*/
public static Integer toIntegerObject(Boolean bool) {
if (bool == null) {
return null;
}
return bool.booleanValue() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
/**
* <p>Converts a Boolean to a Integer using the convention that
* {@code zero} is {@code false}.</p>
*
* <p>{@code null} will be converted to {@code null}.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(Boolean.TRUE) = Integer.valueOf(1)
* BooleanUtils.toIntegerObject(Boolean.FALSE) = Integer.valueOf(0)
* </pre>
*
* @param bool the Boolean to convert
* @return one if Boolean.TRUE, zero if Boolean.FALSE, {@code null} if {@code null}
*/
public static Integer toIntegerObject(final Boolean bool) {
if (bool == null) {
return null;
}
return bool.booleanValue() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
/**
* <p>Converts a Boolean to a Integer using the convention that
* {@code zero} is {@code false}.</p>
*
* <p>{@code null} will be converted to {@code null}.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(Boolean.TRUE) = Integer.valueOf(1)
* BooleanUtils.toIntegerObject(Boolean.FALSE) = Integer.valueOf(0)
* </pre>
*
* @param bool the Boolean to convert
* @return one if Boolean.TRUE, zero if Boolean.FALSE, {@code null} if {@code null}
*/
public static Integer toIntegerObject(Boolean bool) {
if (bool == null) {
return null;
}
return bool.booleanValue() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
/**
* <p>Converts a boolean to an Integer using the convention that
* <code>zero</code> is <code>false</code>.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(true) = new Integer(1)
* BooleanUtils.toIntegerObject(false) = new Integer(0)
* </pre>
*
* @param bool the boolean to convert
* @return one if <code>true</code>, zero if <code>false</code>
*/
public static Integer toIntegerObject(boolean bool) {
return bool ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
/**
* <p>Converts a boolean to an Integer using the convention that
* {@code zero} is {@code false}.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(true) = Integer.valueOf(1)
* BooleanUtils.toIntegerObject(false) = Integer.valueOf(0)
* </pre>
*
* @param bool the boolean to convert
* @return one if {@code true}, zero if {@code false}
*/
public static Integer toIntegerObject(boolean bool) {
return bool ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
/**
* <p>Converts a boolean to an Integer using the convention that
* <code>zero</code> is <code>false</code>.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(true) = new Integer(1)
* BooleanUtils.toIntegerObject(false) = new Integer(0)
* </pre>
*
* @param bool the boolean to convert
* @return one if <code>true</code>, zero if <code>false</code>
*/
public static Integer toIntegerObject(boolean bool) {
return bool ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
/**
* <p>Converts a boolean to an Integer using the convention that
* {@code zero} is {@code false}.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(true) = Integer.valueOf(1)
* BooleanUtils.toIntegerObject(false) = Integer.valueOf(0)
* </pre>
*
* @param bool the boolean to convert
* @return one if {@code true}, zero if {@code false}
*/
public static Integer toIntegerObject(final boolean bool) {
return bool ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}
/**
* <p>Converts a boolean to an Integer using the convention that
* {@code zero} is {@code false}.</p>
*
* <pre>
* BooleanUtils.toIntegerObject(true) = Integer.valueOf(1)
* BooleanUtils.toIntegerObject(false) = Integer.valueOf(0)
* </pre>
*
* @param bool the boolean to convert
* @return one if {@code true}, zero if {@code false}
*/
public static Integer toIntegerObject(boolean bool) {
return bool ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO;
}