java.lang.Boolean.logicalXor()方法的使用及代码示例

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

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

Boolean.logicalXor介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

if (Boolean.logicalXor(hasConj, hasCC)) {
 return Optional.empty();

代码示例来源:origin: com.hubspot/algebra

@Check
 void checkIsOkOrErr() {
  Preconditions.checkState(Boolean.logicalXor(getOkResultMaybe().isPresent(), getErrResultMaybe().isPresent()), "Exactly one of ok/err must be present");
 }
}

代码示例来源:origin: com.vaadin/flow-server

private void checkParameterTypeAndAnnotation(Method method,
    Parameter parameter) {
  boolean hasEventDataAnnotation = parameter
      .isAnnotationPresent(EventData.class)
      || parameter.isAnnotationPresent(ModelItem.class);
  boolean hasRepeatIndexAnnotation = parameter
      .isAnnotationPresent(RepeatIndex.class);
  if (!Boolean.logicalXor(hasEventDataAnnotation,
      hasRepeatIndexAnnotation)) {
    throw new IllegalStateException(String.format(
        "EventHandler method '%s' should have the parameter with index %s annotated either with @EventData annotation (to get any particular data from the event)"
            + " or have 'int' or 'Integer' type and be annotated with @RepeatIndex annotation (to get element index in dom-repeat)",
        method.getName(), getParameterIndex(parameter)));
  } else if (!hasEventDataAnnotation) {
    Class<?> parameterType = parameter.getType();
    if (!parameterType.equals(int.class)
        && !parameterType.equals(Integer.class)) {
      throw new IllegalStateException(String.format(
          "EventHandler method '%s' has parameter with index %s, annotated with @RepeatIndex that has incorrect type '%s', should be 'int' or 'Integer'",
          method.getName(), getParameterIndex(parameter),
          parameterType));
    }
  }
}

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

if (Boolean.logicalXor(hasConj, hasCC)) {
 return Optional.empty();

相关文章