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

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

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

BooleanUtils.negate介绍

[英]Negates the specified boolean.

If null is passed in, null will be returned.

NOTE: This returns null and will throw a NullPointerException if unboxed to a boolean.

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

[中]对指定的布尔值求反。
如果传入null,则返回null。
注意:这将返回null,如果取消绑定到布尔值,将抛出NullPointerException。

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

代码示例

代码示例来源:origin: springside/springside4

/**
 * 取反
 */
public static Boolean negate(final Boolean bool) {
  return BooleanUtils.negate(bool);
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void test_negate_Boolean() {
  assertSame(null, BooleanUtils.negate(null));
  assertSame(Boolean.TRUE, BooleanUtils.negate(Boolean.FALSE));
  assertSame(Boolean.FALSE, BooleanUtils.negate(Boolean.TRUE));
}

代码示例来源:origin: xuminwlt/j360-dubbo-app-all

/**
 * 取反
 */
public static Boolean negate(final Boolean bool) {
  return BooleanUtils.negate(bool);
}

代码示例来源:origin: io.springside/springside-utils

/**
 * 取反
 */
public static Boolean negate(final Boolean bool) {
  return BooleanUtils.negate(bool);
}

代码示例来源:origin: DarLiner/vjtools

/**
 * 取反
 */
public static Boolean negate(final Boolean bool) {
  return BooleanUtils.negate(bool);
}

代码示例来源:origin: pl.edu.icm.cocos/cocos-services

@Override
protected List<Predicate> getPredicates(Root<CocosUser> root, CriteriaBuilder cb) {
  List<Predicate> predicates = new ArrayList<>();
  predicates.add(createLikePredicate("username", inquiry.getUsername(), root, cb));
  if (inquiry.getQuota() != null) {
    predicates.add(createGreaterThanPredicate("filesystemQuota", inquiry.getQuota().getGreaterThan(), root, cb, false));
    predicates.add(createLessThanPredicate("filesystemQuota", inquiry.getQuota().getLessThan(), root, cb, false));
  }
  predicates.add(createEqualsPredicate("domain", inquiry.getDomain(), root, cb));
  if(CollectionUtils.isNotEmpty(inquiry.getRoles())){
    predicates.add(createInPredicate("authorities.authority", inquiry.getRoles(), root, cb, true));
  }
  predicates.add(createEqualsPredicate("enabled", inquiry.isEnabled(), root, cb));
  predicates.add(createEqualsPredicate("accountNonLocked", BooleanUtils.negate(inquiry.isLocked()), root, cb));
  return predicates;
}

相关文章