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

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

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

BooleanUtils.toBooleanDefaultIfNull介绍

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

[中]将布尔值转换为布尔值处理null

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

代码示例

代码示例来源:origin: jenkinsci/nunit-plugin

@Deprecated
public NUnitPublisher(String testResultsPattern, boolean debug, boolean keepJUnitReports, boolean skipJUnitArchiver,
           Boolean failIfNoResults, Boolean failedTestsFailBuild) {
  this.testResultsPattern = testResultsPattern;
  this.debug = debug;
  if (this.debug) {
    this.keepJUnitReports = keepJUnitReports;
    this.skipJUnitArchiver = skipJUnitArchiver;
  }
  this.failIfNoResults = BooleanUtils.toBooleanDefaultIfNull(failIfNoResults, Boolean.TRUE);
  this.failedTestsFailBuild = BooleanUtils.toBooleanDefaultIfNull(failedTestsFailBuild, Boolean.FALSE);
}

代码示例来源:origin: jenkinsci/nunit-plugin

public Object readResolve() {
  return new NUnitPublisher(
    testResultsPattern, 
    debug, 
    keepJUnitReports, 
    skipJUnitArchiver, 
    BooleanUtils.toBooleanDefaultIfNull(failIfNoResults, Boolean.TRUE),
    BooleanUtils.toBooleanDefaultIfNull(failedTestsFailBuild, Boolean.FALSE));
}

代码示例来源:origin: gentics/mesh

/**
   * Check whether the recursive flag for recursive deletion is enabled.
   * 
   * @return
   */
  default boolean isRecursive() {
    return BooleanUtils.toBooleanDefaultIfNull(Boolean.valueOf(getParameter(RECURSIVE_PARAMETER_KEY)), false);
  }
}

代码示例来源:origin: net.di2e.ecdr.libs/cdr-rest-search-commons

protected boolean isIncludeStatus( MultivaluedMap<String, String> queryParameters ) {
  // Include status is true unless explicitly set to false
  return BooleanUtils.toBooleanDefaultIfNull( SearchUtils.getBoolean( queryParameters.getFirst( SearchConstants.STATUS_PARAMETER ) ), true );
}

代码示例来源:origin: gentics/mesh

/**
 * Check whether the recursive flag for recursively publishing is enabled.
 * 
 * @return
 */
default boolean isRecursive() {
  return BooleanUtils.toBooleanDefaultIfNull(Boolean.valueOf(getParameter(RECURSIVE_PARAMETER_KEY)), false);
}

代码示例来源:origin: net.di2e.ecdr.libs/cdr-rest-search-commons

protected boolean isIncludeStatus( MultivaluedMap<String, String> queryParameters ) {
  // Include status is true unless explicitly set to false
  return BooleanUtils.toBooleanDefaultIfNull( SearchUtils.getBoolean( queryParameters.getFirst( SearchConstants.STATUS_PARAMETER ) ), true );
}

代码示例来源:origin: net.di2e.ecdr.libs/cdr-rest-search-commons

protected void populateStrictMode( MultivaluedMap<String, String> queryParameters ) {
  isStrictMode = BooleanUtils.toBooleanDefaultIfNull( SearchUtils.getBoolean( queryParameters.getFirst( SearchConstants.STRICTMODE_PARAMETER ) ), false );
}

代码示例来源:origin: gentics/mesh

/**
 * Return the flag which indicates whether the created schema version should automatically be assigned to the branches which reference the schema.
 * 
 * @return
 */
default boolean getUpdateAssignedBranches() {
  String value = getParameter(UPDATE_ASSIGNED_BRANCHES_QUERY_PARAM_KEY);
  return BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(value), true);
}

代码示例来源:origin: info.magnolia/magnolia-gui

public String getSaveInfo() {
  Boolean renderSaveInfo = BooleanUtils.toBooleanObject(this.getConfigValue("saveInfo"));
  if (BooleanUtils.toBooleanDefaultIfNull(renderSaveInfo, true)) {
    ControlImpl dummy = new ControlImpl(this.getName(), (String) null);
    if (!isSaveAsList() && !isSaveAsJSON()) {
      dummy.setValueType(ControlImpl.VALUETYPE_MULTIPLE);
    }
    return dummy.getHtmlSaveInfo();
  }
  // don' create the save info
  return "";
}

相关文章