java.lang.Boolean类的使用及代码示例

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

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

Boolean介绍

[英]The wrapper for the primitive type boolean.
[中]基本类型boolean的包装器。

代码示例

代码示例来源:origin: apache/incubator-dubbo

public static Boolean boxed(boolean v) {
  return Boolean.valueOf(v);
}

代码示例来源:origin: apache/incubator-dubbo

private static String convertLegacyValue(String key, String value) {
  if (value != null && value.length() > 0) {
    if ("dubbo.service.max.retry.providers".equals(key)) {
      return String.valueOf(Integer.parseInt(value) - 1);
    } else if ("dubbo.service.allow.no.provider".equals(key)) {
      return String.valueOf(!Boolean.parseBoolean(value));
    }
  }
  return value;
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Is default HTML escaping active? Falls back to {@code false} in case of no explicit default given.
 */
public boolean isDefaultHtmlEscape() {
  return (this.defaultHtmlEscape != null && this.defaultHtmlEscape.booleanValue());
}

代码示例来源:origin: shuzheng/zheng

@Override
public void setProperties(Properties properties) {
  super.setProperties(properties);
  this.addGWTInterface = Boolean.valueOf(properties.getProperty("addGWTInterface")).booleanValue();
  this.suppressJavaInterface = Boolean.valueOf(properties.getProperty("suppressJavaInterface")).booleanValue();
}

代码示例来源:origin: libgdx/libgdx

private Object toObject (String key, String value) {
  if (key.endsWith("b")) return new Boolean(Boolean.parseBoolean(value));
  if (key.endsWith("i")) return new Integer(Integer.parseInt(value));
  if (key.endsWith("l")) return new Long(Long.parseLong(value));
  if (key.endsWith("f")) return new Float(Float.parseFloat(value));
  return value;
}

代码示例来源:origin: alibaba/druid

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + (Boolean.valueOf(parenthesized).hashCode());
  result = prime * result + distionOption;
  result = prime * result + ((from == null) ? 0 : from.hashCode());
  result = prime * result + ((groupBy == null) ? 0 : groupBy.hashCode());
  result = prime * result + ((into == null) ? 0 : into.hashCode());
  result = prime * result + ((selectList == null) ? 0 : selectList.hashCode());
  result = prime * result + ((where == null) ? 0 : where.hashCode());
  return result;
}

代码示例来源:origin: apache/incubator-dubbo

public void setGeneric(Boolean generic) {
  if (generic != null) {
    this.generic = generic.toString();
  }
}

代码示例来源:origin: alibaba/druid

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  SQLDataTypeImpl dataType = (SQLDataTypeImpl) o;
  if (name != null ? !name.equals(dataType.name) : dataType.name != null) return false;
  if (arguments != null ? !arguments.equals(dataType.arguments) : dataType.arguments != null) return false;
  return withTimeZone != null ? withTimeZone.equals(dataType.withTimeZone) : dataType.withTimeZone == null;
}

代码示例来源:origin: google/guava

public void testCompare() {
 for (boolean x : VALUES) {
  for (boolean y : VALUES) {
   // note: spec requires only that the sign is the same
   assertEquals(x + ", " + y, Boolean.valueOf(x).compareTo(y), Booleans.compare(x, y));
  }
 }
}

代码示例来源:origin: google/guava

@Generates
private Boolean generateBooleanObject() {
 return new Boolean(generateBoolean());
}

代码示例来源:origin: apache/incubator-dubbo

public void setGeneric(Boolean generic) {
  if (generic != null) {
    this.generic = generic.toString();
  }
}

代码示例来源:origin: jenkinsci/jenkins

@Override
  public boolean process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
    if (Boolean.TRUE.equals(request.getAttribute(BasicHeaderApiTokenAuthenticator.class.getName()))) {
      chain.doFilter(request, response);
      return true;
    }
    return false;
  }
}

代码示例来源:origin: libgdx/libgdx

private Object toObject (String key, String value) {
  if (key.endsWith("b")) return new Boolean(Boolean.parseBoolean(value));
  if (key.endsWith("i")) return new Integer(Integer.parseInt(value));
  if (key.endsWith("l")) return new Long(Long.parseLong(value));
  if (key.endsWith("f")) return new Float(Float.parseFloat(value));
  return value;
}

代码示例来源:origin: apache/incubator-dubbo

public static Boolean boxed(boolean v) {
  return Boolean.valueOf(v);
}

代码示例来源:origin: apache/incubator-dubbo

private static String convertLegacyValue(String key, String value) {
  if (value != null && value.length() > 0) {
    if ("dubbo.service.max.retry.providers".equals(key)) {
      return String.valueOf(Integer.parseInt(value) - 1);
    } else if ("dubbo.service.allow.no.provider".equals(key)) {
      return String.valueOf(!Boolean.parseBoolean(value));
    }
  }
  return value;
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Is HTML escaping using the response encoding by default?
 * If enabled, only XML markup significant characters will be escaped with UTF-* encodings.
 * <p>Falls back to {@code true} in case of no explicit default given, as of Spring 4.2.
 * @since 4.1.2
 */
public boolean isResponseEncodedHtmlEscape() {
  return (this.responseEncodedHtmlEscape == null || this.responseEncodedHtmlEscape.booleanValue());
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Programmatically set a local flag to "true", overriding an
 * entry in the {@code spring.properties} file (if any).
 * @param key the property key
 */
public static void setFlag(String key) {
  localProperties.put(key, Boolean.TRUE.toString());
}

代码示例来源:origin: spring-projects/spring-framework

protected ScriptEngine getEngine() {
  if (Boolean.FALSE.equals(this.sharedEngine)) {
    Assert.state(this.engineName != null, "No engine name specified");
    return createEngineFromName(this.engineName);
  }
  else {
    Assert.state(this.engine != null, "No shared engine available");
    return this.engine;
  }
}

代码示例来源:origin: libgdx/libgdx

public Object getObject () {
    return Boolean.valueOf(value);
  }
};

代码示例来源:origin: ReactiveX/RxJava

void load(Properties properties) {
    if (properties.containsKey(PURGE_ENABLED_KEY)) {
      purgeEnable = Boolean.parseBoolean(properties.getProperty(PURGE_ENABLED_KEY));
    } else {
      purgeEnable = true;
    }
    if (purgeEnable && properties.containsKey(PURGE_PERIOD_SECONDS_KEY)) {
      try {
        purgePeriod = Integer.parseInt(properties.getProperty(PURGE_PERIOD_SECONDS_KEY));
      } catch (NumberFormatException ex) {
        purgePeriod = 1;
      }
    } else {
      purgePeriod = 1;
    }
  }
}

相关文章