本文整理了Java中org.apache.commons.lang3.BooleanUtils.toStringYesNo()
方法的一些代码示例,展示了BooleanUtils.toStringYesNo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanUtils.toStringYesNo()
方法的具体详情如下:
包路径:org.apache.commons.lang3.BooleanUtils
类名称:BooleanUtils
方法名:toStringYesNo
[英]Converts a Boolean to a String returning 'yes', 'no', or null.
BooleanUtils.toStringYesNo(Boolean.TRUE) = "yes"
BooleanUtils.toStringYesNo(Boolean.FALSE) = "no"
BooleanUtils.toStringYesNo(null) = null;
[中]将布尔值转换为返回“是”、“否”或null的字符串。
BooleanUtils.toStringYesNo(Boolean.TRUE) = "yes"
BooleanUtils.toStringYesNo(Boolean.FALSE) = "no"
BooleanUtils.toStringYesNo(null) = null;
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void test_toStringYesNo_Boolean() {
assertNull(BooleanUtils.toStringYesNo(null));
assertEquals("yes", BooleanUtils.toStringYesNo(Boolean.TRUE));
assertEquals("no", BooleanUtils.toStringYesNo(Boolean.FALSE));
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void test_toStringYesNo_boolean() {
assertEquals("yes", BooleanUtils.toStringYesNo(true));
assertEquals("no", BooleanUtils.toStringYesNo(false));
}
代码示例来源:origin: org.apereo.cas/cas-server-support-reports
/**
* Sso status response entity.
*
* @param request the request
* @return the response entity
*/
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> ssoStatus(final HttpServletRequest request) {
val tgtId = this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request);
if (StringUtils.isBlank(tgtId)) {
return ResponseEntity.ok(BooleanUtils.toStringYesNo(false));
}
val auth = this.ticketRegistrySupport.getAuthenticationFrom(tgtId);
return ResponseEntity.ok(BooleanUtils.toStringYesNo(auth != null));
}
}
代码示例来源:origin: org.apereo.cas/cas-server-core-validation-api
@Override
public boolean isSatisfiedBy(final Assertion assertion, final HttpServletRequest request) {
LOGGER.trace("Is validation specification set to enforce [{}] protocol behavior? [{}]. Is assertion issued from a new login? [{}]",
CasProtocolConstants.PARAMETER_RENEW, BooleanUtils.toStringYesNo(this.renew),
BooleanUtils.toStringYesNo(assertion.isFromNewLogin()));
var satisfied = isSatisfiedByInternal(assertion);
if (!satisfied) {
LOGGER.warn("[{}] is not internally satisfied by the produced assertion", getClass().getSimpleName());
return false;
}
satisfied = !this.renew || assertion.isFromNewLogin();
if (!satisfied) {
LOGGER.warn("[{}] is to enforce the [{}] CAS protocol behavior, yet the assertion is not issued from a new login", getClass().getSimpleName(),
CasProtocolConstants.PARAMETER_RENEW);
return false;
}
LOGGER.trace("Validation specification is satisfied by the produced assertion");
return true;
}
代码示例来源:origin: org.apereo.cas/cas-server-support-saml-idp-core
@Override
protected Map<String, Object> getAttributesForSamlRegisteredService(final Map<String, Object> attributes,
final SamlRegisteredService service,
final ApplicationContext applicationContext,
final SamlRegisteredServiceCachingMetadataResolver resolver,
final SamlRegisteredServiceServiceProviderMetadataFacade facade,
final EntityDescriptor entityDescriptor) {
val pattern = RegexUtils.createPattern(this.entityIds);
val entityID = entityDescriptor.getEntityID();
val matcher = pattern.matcher(entityID);
val matched = fullMatch ? matcher.matches() : matcher.find();
LOGGER.debug("Pattern [{}] matched against [{}]? [{}]", pattern.pattern(), entityID, BooleanUtils.toStringYesNo(matched));
if (matched) {
return authorizeReleaseOfAllowedAttributes(attributes);
}
return new HashMap<>(0);
}
}
代码示例来源:origin: org.apereo.cas/cas-server-support-cookie
private boolean isRememberMeAuthentication(final RequestContext requestContext) {
final HttpServletRequest request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext);
final String value = request.getParameter(RememberMeCredential.REQUEST_PARAMETER_REMEMBER_ME);
LOGGER.debug("Locating request parameter [{}] with value [{}]", RememberMeCredential.REQUEST_PARAMETER_REMEMBER_ME, value);
boolean isRememberMe = StringUtils.isNotBlank(value) && WebUtils.isRememberMeAuthenticationEnabled(requestContext);
if (!isRememberMe) {
LOGGER.debug("Request does not indicate a remember-me authentication event. Locating authentication object from the request context...");
final Authentication auth = WebUtils.getAuthentication(requestContext);
if (auth != null) {
final Map<String, Object> attributes = auth.getAttributes();
LOGGER.debug("Located authentication attributes [{}]", attributes);
if (attributes.containsKey(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME)) {
final Object rememberMeValue = attributes.getOrDefault(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME, false);
LOGGER.debug("Located remember-me authentication attribute [{}]", rememberMeValue);
isRememberMe = CollectionUtils.wrapSet(rememberMeValue).contains(true);
}
}
}
LOGGER.debug("Is this request from a remember-me authentication event? [{}]", BooleanUtils.toStringYesNo(isRememberMe));
return isRememberMe;
}
代码示例来源:origin: org.apereo.cas/cas-server-core-util-api
StringUtils.capitalize(BooleanUtils.toStringYesNo(latestSem.isStable())));
info.put("Update Availability", updateString);
代码示例来源:origin: com.github.fosin/cdp-core
formatter.format("JVM Maximum Memory: %s%n", FileUtils.byteCountToDisplaySize(runtime.maxMemory()));
formatter.format("JVM Total Memory: %s%n", FileUtils.byteCountToDisplaySize(runtime.totalMemory()));
formatter.format("JCE Installed: %s%n", StringUtils.capitalize(BooleanUtils.toStringYesNo(isJceInstalled())));
formatter.format("%s%n", LINE_SEPARATOR);
代码示例来源:origin: org.apereo.cas/cas-server-core-util-api
info.put("JVM Total Memory", FileUtils.byteCountToDisplaySize(runtime.totalMemory()));
info.put("JCE Installed", StringUtils.capitalize(BooleanUtils.toStringYesNo(EncodingUtils.isJceInstalled())));
代码示例来源:origin: org.apereo.cas/cas-server-support-saml-idp-metadata
@Override
protected void doHealthCheck(final Health.Builder builder) {
val samlServices = servicesManager.findServiceBy(registeredService -> registeredService instanceof SamlRegisteredService);
val availableResolvers = this.metadataResolutionPlan.getRegisteredMetadataResolvers();
LOGGER.debug("There are [{}] metadata resolver(s) available in the chain", availableResolvers.size());
builder.up();
samlServices.stream()
.map(SamlRegisteredService.class::cast)
.forEach(service -> availableResolvers
.stream()
.filter(Objects::nonNull)
.forEach(r -> {
LOGGER.debug("Evaluating whether metadata resolver [{}] is available for service [{}]", r.getName(), service.getName());
val available = r.isAvailable(service);
val map = new HashMap<String, Object>();
map.put("name", service.getName());
map.put("id", service.getId());
map.put("metadataLocation", service.getMetadataLocation());
map.put("serviceId", service.getServiceId());
map.put("availability", BooleanUtils.toStringYesNo(available));
builder.withDetail(service.getName(), map);
if (!available) {
builder.down();
}
}));
}
}
内容来源于网络,如有侵权,请联系作者删除!