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

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

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

BooleanUtils.isFalse介绍

[英]Checks if a Boolean value is false, handling null by returning false.

BooleanUtils.isFalse(Boolean.TRUE)  = false 
BooleanUtils.isFalse(Boolean.FALSE) = true 
BooleanUtils.isFalse(null)          = false

[中]检查布尔值是否为false,通过返回false处理null。

BooleanUtils.isFalse(Boolean.TRUE)  = false 
BooleanUtils.isFalse(Boolean.FALSE) = true 
BooleanUtils.isFalse(null)          = false

代码示例

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

/**
 * <p>Checks if a {@code Boolean} value is <i>not</i> {@code false},
 * handling {@code null} by returning {@code true}.</p>
 *
 * <pre>
 *   BooleanUtils.isNotFalse(Boolean.TRUE)  = true
 *   BooleanUtils.isNotFalse(Boolean.FALSE) = false
 *   BooleanUtils.isNotFalse(null)          = true
 * </pre>
 *
 * @param bool  the boolean to check, null returns {@code true}
 * @return {@code true} if the input is null or true
 * @since 2.3
 */
public static boolean isNotFalse(final Boolean bool) {
  return !isFalse(bool);
}

代码示例来源:origin: kiegroup/optaplanner

public void initBenchmarkReportDirectory(File benchmarkDirectory) {
  String timestampString = startingTimestamp.format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HHmmss"));
  if (StringUtils.isEmpty(name)) {
    name = timestampString;
  }
  if (!benchmarkDirectory.mkdirs()) {
    if (!benchmarkDirectory.isDirectory()) {
      throw new IllegalArgumentException("The benchmarkDirectory (" + benchmarkDirectory
          + ") already exists, but is not a directory.");
    }
    if (!benchmarkDirectory.canWrite()) {
      throw new IllegalArgumentException("The benchmarkDirectory (" + benchmarkDirectory
          + ") already exists, but is not writable.");
    }
  }
  int duplicationIndex = 0;
  do {
    String directoryName = timestampString + (duplicationIndex == 0 ? "" : "_" + duplicationIndex);
    duplicationIndex++;
    benchmarkReportDirectory = new File(benchmarkDirectory,
        BooleanUtils.isFalse(aggregation) ? directoryName : directoryName + "_aggregation");
  } while (!benchmarkReportDirectory.mkdir());
  for (ProblemBenchmarkResult problemBenchmarkResult : unifiedProblemBenchmarkResultList) {
    problemBenchmarkResult.makeDirs();
  }
}

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

@Test
public void test_isFalse_Boolean() {
  assertFalse(BooleanUtils.isFalse(Boolean.TRUE));
  assertTrue(BooleanUtils.isFalse(Boolean.FALSE));
  assertFalse(BooleanUtils.isFalse(null));
}

代码示例来源:origin: kiegroup/optaplanner

private <Solution_> ProblemBenchmarkResult<Solution_> buildProblemBenchmark(SolverConfigContext solverConfigContext,
    PlannerBenchmarkResult plannerBenchmarkResult,
    ProblemProvider<Solution_> problemProvider) {
  ProblemBenchmarkResult<Solution_> problemBenchmarkResult = new ProblemBenchmarkResult<>(plannerBenchmarkResult);
  problemBenchmarkResult.setName(problemProvider.getProblemName());
  problemBenchmarkResult.setProblemProvider(problemProvider);
  problemBenchmarkResult.setWriteOutputSolutionEnabled(
      writeOutputSolutionEnabled == null ? false : writeOutputSolutionEnabled);
  List<ProblemStatistic> problemStatisticList;
  if (BooleanUtils.isFalse(problemStatisticEnabled)) {
    if (!ConfigUtils.isEmptyCollection(problemStatisticTypeList)) {
      throw new IllegalArgumentException("The problemStatisticEnabled (" + problemStatisticEnabled
          + ") and problemStatisticTypeList (" + problemStatisticTypeList + ") can be used together.");
    }
    problemStatisticList = Collections.emptyList();
  } else {
    List<ProblemStatisticType> problemStatisticTypeList_ = (problemStatisticTypeList == null)
        ? Collections.singletonList(ProblemStatisticType.BEST_SCORE) : problemStatisticTypeList;
    problemStatisticList = new ArrayList<>(problemStatisticTypeList_.size());
    for (ProblemStatisticType problemStatisticType : problemStatisticTypeList_) {
      problemStatisticList.add(problemStatisticType.buildProblemStatistic(problemBenchmarkResult));
    }
  }
  problemBenchmarkResult.setProblemStatisticList(problemStatisticList);
  problemBenchmarkResult.setSingleBenchmarkResultList(new ArrayList<>());
  return problemBenchmarkResult;
}

代码示例来源:origin: kiegroup/optaplanner

Collection<GenuineVariableDescriptor> variableDescriptors = deduceVariableDescriptorList(
    entitySelector.getEntityDescriptor(), variableNameIncludeList);
if (BooleanUtils.isFalse(subPillarEnabled)
    && (minimumSubPillarSize != null || maximumSubPillarSize != null)) {
  throw new IllegalArgumentException("The pillarSelectorConfig (" + this

代码示例来源:origin: metatron-app/metatron-discovery

@Override
public boolean enableSortField() {
 return BooleanUtils.isFalse(discontinuous) && unit != TimeUnit.YEAR;
}

代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3

/**
 * <p>Checks if a {@code Boolean} value is <i>not</i> {@code false},
 * handling {@code null} by returning {@code true}.</p>
 *
 * <pre>
 *   BooleanUtils.isNotFalse(Boolean.TRUE)  = true
 *   BooleanUtils.isNotFalse(Boolean.FALSE) = false
 *   BooleanUtils.isNotFalse(null)          = true
 * </pre>
 *
 * @param bool  the boolean to check, null returns {@code true}
 * @return {@code true} if the input is null or true
 * @since 2.3
 */
public static boolean isNotFalse(final Boolean bool) {
  return !isFalse(bool);
}

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/**
 * <p>Checks if a {@code Boolean} value is <i>not</i> {@code false},
 * handling {@code null} by returning {@code true}.</p>
 *
 * <pre>
 *   BooleanUtils.isNotFalse(Boolean.TRUE)  = true
 *   BooleanUtils.isNotFalse(Boolean.FALSE) = false
 *   BooleanUtils.isNotFalse(null)          = true
 * </pre>
 *
 * @param bool  the boolean to check, null returns {@code true}
 * @return {@code true} if the input is null or true
 * @since 2.3
 */
public static boolean isNotFalse(final Boolean bool) {
  return !isFalse(bool);
}

代码示例来源:origin: daniellitoc/xultimate-toolkit

/**
 * <p>Checks if a {@code Boolean} value is {@code false},
 * handling {@code null} by returning {@code false}.</p>
 *
 * <pre>
 *   BooleanUtils.isFalse(Boolean.TRUE)  = false
 *   BooleanUtils.isFalse(Boolean.FALSE) = true
 *   BooleanUtils.isFalse(null)          = false
 * </pre>
 *
 * @param bool  the boolean to check, null returns {@code false}
 * @return {@code true} only if the input is non-null and false
 * @since 2.1
 */
public static boolean isFalse(Boolean bool) {
   return org.apache.commons.lang3.BooleanUtils.isFalse(bool);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * <p>Checks if a {@code Boolean} value is <i>not</i> {@code false},
 * handling {@code null} by returning {@code true}.</p>
 *
 * <pre>
 *   BooleanUtils.isNotFalse(Boolean.TRUE)  = true
 *   BooleanUtils.isNotFalse(Boolean.FALSE) = false
 *   BooleanUtils.isNotFalse(null)          = true
 * </pre>
 *
 * @param bool  the boolean to check, null returns {@code true}
 * @return {@code true} if the input is null or true
 * @since 2.3
 */
public static boolean isNotFalse(final Boolean bool) {
  return !isFalse(bool);
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
protected void updateText() {
  if (operator == Op.NOT_EMPTY) {
    if (BooleanUtils.isTrue((Boolean) param.getValue())) {
      text = text.replace("not exists", "exists");
    } else if (BooleanUtils.isFalse((Boolean) param.getValue()) && !text.contains("not exists")) {
      text = text.replace("exists ", "not exists ");
    }
  }
  if (!isCollection) {
    if (operator == Op.ENDS_WITH || operator == Op.STARTS_WITH || operator == Op.CONTAINS || operator == Op.DOES_NOT_CONTAIN) {
      Matcher matcher = LIKE_PATTERN.matcher(text);
      if (matcher.find()) {
        String escapeCharacter = ("\\".equals(QueryUtils.ESCAPE_CHARACTER) || "$".equals(QueryUtils.ESCAPE_CHARACTER))
            ? QueryUtils.ESCAPE_CHARACTER + QueryUtils.ESCAPE_CHARACTER
            : QueryUtils.ESCAPE_CHARACTER;
        text = matcher.replaceAll("$1 ESCAPE '" + escapeCharacter + "' ");
      }
    }
  } else {
    if (operator == Op.CONTAINS) {
      text = text.replace("not exists", "exists");
    } else if (operator == Op.DOES_NOT_CONTAIN && !text.contains("not exists")) {
      text = text.replace("exists ", "not exists ");
    }
  }
}

代码示例来源:origin: org.opensingular/singular-form-core

private static boolean isRejected(SInstance instance) {
  return isFalse(instance.asAtrAnnotation().approved());
}

代码示例来源:origin: org.finra.herd/herd-dao

else if (BooleanUtils.isFalse(isParentTagNull))

代码示例来源:origin: Nincraft/ModPackDownloader

private CurseFile checkBackupVersions(String releaseType, CurseFile curseFile, JSONObject fileListJson, String mcVersion, CurseFile newMod) {
  CurseFile returnMod = newMod;
  for (String backupVersion : arguments.getBackupVersions()) {
    log.debug("No files found for Minecraft {}, checking backup version {}", mcVersion, backupVersion);
    returnMod = getLatestVersion(releaseType, curseFile, fileListJson, backupVersion);
    if (BooleanUtils.isFalse(newMod.getSkipDownload())) {
      curseFile.setSkipDownload(null);
      log.debug("Found update for {} in Minecraft {}", curseFile.getName(), backupVersion);
      break;
    }
  }
  return returnMod;
}

代码示例来源:origin: org.opensingular/singular-form-core

/**
 * Returns true if the given instance or any of its children is annotated with an refusal
 * @param instance
 * @return
 */
public boolean hasAnyRefusalOnTree(SInstance instance) {
  return SInstances.hasAny(instance, i -> hasAnnotation(i) && BooleanUtils.isFalse(i.asAtrAnnotation().annotation().getApproved()));
}

代码示例来源:origin: org.opensingular/singular-form-core

/** Retorna true se a instância ou algum de seus filhos tiver uma anotação marcadada como não aprovada. */
public boolean hasAnyRefusal(SInstance instance) {
  return SInstances.hasAny(instance, i -> hasAnnotation(i) && BooleanUtils.isFalse(i.asAtrAnnotation().annotation().getApproved()));
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-apidoc-core

@Override
public void handleEvent(Event event) {
  if (!(event.getContext() instanceof DocumentEventContext)) {
    return;
  }
  DocumentEventContext ctx = (DocumentEventContext) event.getContext();
  DocumentModel srcDoc = ctx.getSourceDocument();
  if (!TYPE_NAME.equals(srcDoc.getType())) {
    return;
  }
  CoreSession session = ctx.getCoreSession();
  List<String> flags = Arrays.asList(PROP_LATEST_FT, PROP_LATEST_LTS);
  flags.forEach(flag -> {
    if (isFalse((Boolean) srcDoc.getPropertyValue(flag))) {
      return;
    }
    String query = String.format(DISTRIBUTION_QUERY, TYPE_NAME, flag);
    session.query(query)
        .stream()
        .filter(doc -> srcDoc.getId() == null || !doc.getId().equals(srcDoc.getId()))
        .forEach(doc -> {
      doc.setPropertyValue(flag, false);
      session.saveDocument(doc);
    });
  });
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@SuppressWarnings("unchecked")
protected TextField createTextField(Datatype datatype) {
  TextField textField = uiComponents.create(TextField.class);
  textField.setDatatype(datatype);
  if (!BooleanUtils.isFalse(editable)) {
    FilterHelper.ShortcutListener shortcutListener = new FilterHelper.ShortcutListener("add", new KeyCombination(KeyCombination.Key.ENTER)) {
      @Override
      public void handleShortcutPressed() {
        _addValue(textField);
      }
    };
    filterHelper.addShortcutListener(textField, shortcutListener);
  }
  return textField;
}

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

@Override
public boolean isAvailable(Node node, TemplateDefinition templateDefinition) {
  if (node == null || templateDefinition == null) {
    return false;
  }
  // Templates with visible property is set to false are not available
  if (BooleanUtils.isFalse(templateDefinition.getVisible())) {
    return false;
  }
  if (templateDefinition instanceof ResourceTemplate && JcrResourceOrigin.RESOURCES_WORKSPACE.equals(getNodeWorkspaceName(node))) {
    return true;
  }
  // Without valid site we default to fallback
  final Site site = siteFunctions.site(node);
  if (site == null) {
    return fallbackTemplateAvailability.isAvailable(node, templateDefinition);
  }
  // Without valid template settings or availability we default to fallback too
  final TemplateSettings templateSettings = site.getTemplates();
  if (templateSettings == null || templateSettings.getAvailability() == null) {
    return fallbackTemplateAvailability.isAvailable(node, templateDefinition);
  }
  return site.getTemplates().getAvailability().isAvailable(node, templateDefinition);
}

代码示例来源:origin: Evolveum/midpoint

private <T extends ObjectType> String addObject(PrismObject<T> object, boolean overwrite, ImportOptionsType importOptions,
    Task task, OperationResult parentResult) throws ObjectAlreadyExistsException, SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException {
  ObjectDelta<T> delta = DeltaFactory.Object.createAddDelta(object);
  Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(delta);
  ModelExecuteOptions modelOptions;
  if (importOptions.getModelExecutionOptions() != null) {
    modelOptions = ModelExecuteOptions.fromModelExecutionOptionsType(importOptions.getModelExecutionOptions());
  } else {
    modelOptions = new ModelExecuteOptions();
  }
  if (modelOptions.getRaw() == null) {
    modelOptions.setRaw(true);
  }
  if (modelOptions.getOverwrite() == null) {
    modelOptions.setOverwrite(overwrite);
  }
  if (isFalse(importOptions.isEncryptProtectedValues()) && modelOptions.getNoCrypt() == null) {
    modelOptions.setNoCrypt(true);
  }
  modelService.executeChanges(deltas, modelOptions, task, parentResult);
  return deltas.iterator().next().getOid();
}

相关文章