/** * <p>Converts a boolean to a String returning {@code 'yes'} * or {@code 'no'}.</p> * * <pre> * BooleanUtils.toStringYesNo(true) = "yes" * BooleanUtils.toStringYesNo(false) = "no" * </pre> * * @param bool the Boolean to check * @return {@code 'yes'}, {@code 'no'}, or {@code null} */ public static String toStringYesNo(final boolean bool) { return toString(bool, "yes", "no"); }
/** * <p>Converts a boolean to a String returning {@code 'on'} * or {@code 'off'}.</p> * * <pre> * BooleanUtils.toStringOnOff(true) = "on" * BooleanUtils.toStringOnOff(false) = "off" * </pre> * * @param bool the Boolean to check * @return {@code 'on'}, {@code 'off'}, or {@code null} */ public static String toStringOnOff(final boolean bool) { return toString(bool, "on", "off"); }
/** * <p>Converts a boolean to a String returning {@code 'true'} * or {@code 'false'}.</p> * * <pre> * BooleanUtils.toStringTrueFalse(true) = "true" * BooleanUtils.toStringTrueFalse(false) = "false" * </pre> * * @param bool the Boolean to check * @return {@code 'true'}, {@code 'false'}, or {@code null} */ public static String toStringTrueFalse(final boolean bool) { return toString(bool, "true", "false"); }
/** * <p>Converts a Boolean to a String returning {@code 'yes'}, * {@code 'no'}, or {@code null}.</p> * * <pre> * BooleanUtils.toStringYesNo(Boolean.TRUE) = "yes" * BooleanUtils.toStringYesNo(Boolean.FALSE) = "no" * BooleanUtils.toStringYesNo(null) = null; * </pre> * * @param bool the Boolean to check * @return {@code 'yes'}, {@code 'no'}, or {@code null} */ public static String toStringYesNo(final Boolean bool) { return toString(bool, "yes", "no", null); }
/** * <p>Converts a Boolean to a String returning {@code 'on'}, * {@code 'off'}, or {@code null}.</p> * * <pre> * BooleanUtils.toStringOnOff(Boolean.TRUE) = "on" * BooleanUtils.toStringOnOff(Boolean.FALSE) = "off" * BooleanUtils.toStringOnOff(null) = null; * </pre> * * @param bool the Boolean to check * @return {@code 'on'}, {@code 'off'}, or {@code null} */ public static String toStringOnOff(final Boolean bool) { return toString(bool, "on", "off", null); }
/** * <p>Converts a Boolean to a String returning {@code 'true'}, * {@code 'false'}, or {@code null}.</p> * * <pre> * BooleanUtils.toStringTrueFalse(Boolean.TRUE) = "true" * BooleanUtils.toStringTrueFalse(Boolean.FALSE) = "false" * BooleanUtils.toStringTrueFalse(null) = null; * </pre> * * @param bool the Boolean to check * @return {@code 'true'}, {@code 'false'}, or {@code null} */ public static String toStringTrueFalse(final Boolean bool) { return toString(bool, "true", "false", null); }
/** * <p>Converts a boolean to a String returning {@code 'on'} * or {@code 'off'}.</p> * * <pre> * BooleanUtils.toStringOnOff(true) = "on" * BooleanUtils.toStringOnOff(false) = "off" * </pre> * * @param bool the Boolean to check * @return {@code 'on'}, {@code 'off'}, or {@code null} */ public static String toStringOnOff(final boolean bool) { return toString(bool, "on", "off"); }
/** * <p>Converts a boolean to a String returning {@code 'true'} * or {@code 'false'}.</p> * * <pre> * BooleanUtils.toStringTrueFalse(true) = "true" * BooleanUtils.toStringTrueFalse(false) = "false" * </pre> * * @param bool the Boolean to check * @return {@code 'true'}, {@code 'false'}, or {@code null} */ public static String toStringTrueFalse(final boolean bool) { return toString(bool, "true", "false"); }
/** * <p>Converts a boolean to a String returning {@code 'on'} * or {@code 'off'}.</p> * * <pre> * BooleanUtils.toStringOnOff(true) = "on" * BooleanUtils.toStringOnOff(false) = "off" * </pre> * * @param bool the Boolean to check * @return {@code 'on'}, {@code 'off'}, or {@code null} */ public static String toStringOnOff(final boolean bool) { return toString(bool, "on", "off"); }
/** * <p>Converts a boolean to a String returning {@code 'yes'} * or {@code 'no'}.</p> * * <pre> * BooleanUtils.toStringYesNo(true) = "yes" * BooleanUtils.toStringYesNo(false) = "no" * </pre> * * @param bool the Boolean to check * @return {@code 'yes'}, {@code 'no'}, or {@code null} */ public static String toStringYesNo(final boolean bool) { return toString(bool, "yes", "no"); }
/** * <p>Converts a boolean to a String returning {@code 'yes'} * or {@code 'no'}.</p> * * <pre> * BooleanUtils.toStringYesNo(true) = "yes" * BooleanUtils.toStringYesNo(false) = "no" * </pre> * * @param bool the Boolean to check * @return {@code 'yes'}, {@code 'no'}, or {@code null} */ public static String toStringYesNo(final boolean bool) { return toString(bool, "yes", "no"); }
/** * 设置指定属性的boolean值 * @param e XML节点 * @param attr 属性名 * @param value 属性值 * * @since 1.6.4.41 */ public static void setBoolean(Element e,String attr,boolean value){ if (StringUtils.isNotEmpty(attr)){ e.setAttribute(attr, BooleanUtils.toString(value, "true", "false")); } }
@Override public boolean matches(final CharSequence rawPassword, final String encodedPassword) { val encodedRawPassword = StringUtils.isNotBlank(rawPassword) ? encode(rawPassword.toString()) : null; val matched = StringUtils.equals(encodedRawPassword, encodedPassword); LOGGER.debug("Provided password does{}match the encoded password", BooleanUtils.toString(matched, StringUtils.EMPTY, " not ")); return matched; } }
@Override public boolean supports(final Service service) { val svc = this.servicesManager.findServiceBy(service); val res = svc != null && service.getId().startsWith(this.callbackUrl); LOGGER.trace("Authentication request is{} identified as an OAuth request", BooleanUtils.toString(res, StringUtils.EMPTY, " not")); return res; }
@Override public String[] resolveFrom(final JoinPoint auditableTarget, final Object returnValue) { Objects.requireNonNull(returnValue, "AuditableExecutionResult must not be null"); val surrogateEligibilityResult = AuditableExecutionResult.class.cast(returnValue); val outcome = "Surrogate Authentication " + BooleanUtils .toString(surrogateEligibilityResult.getProperties().containsKey("eligible"), "Eligible", "Ineligible"); val builder = new ToStringBuilder(this, NO_CLASS_NAME_STYLE).append("result", outcome); surrogateEligibilityResult.getService().ifPresent(it -> builder.append("service", it.getId())); surrogateEligibilityResult.getAuthentication().ifPresent(it -> builder.append("selfPrincipal", it.getPrincipal())); builder.append("surrogatePrincipal", surrogateEligibilityResult.getProperties().get("targetUserId")); return new String[]{builder.toString()}; } }
@Override public String[] resolveFrom(final JoinPoint auditableTarget, final Object retval) { Objects.requireNonNull(retval, "Return value must not be null"); val result = AuditableExecutionResult.class.cast(retval); val accessCheckOutcome = "Client Access " + BooleanUtils.toString(result.isExecutionFailure(), "Denied", "Granted"); val builder = new ToStringBuilder(this, NO_CLASS_NAME_STYLE) .append("result", accessCheckOutcome); if (result.getProperties().containsKey(Client.class.getSimpleName())) { builder.append("client", result.getProperties().get(Client.class.getSimpleName())); } result.getRegisteredService().ifPresent(service -> builder.append("registeredService", service.getName() + ':' + service.getServiceId())); return new String[]{builder.toString()}; } }
@Override public void updateSessionExist(String clientId, boolean cleanSession) { this.string().set(RedisKey.session(clientId), BooleanUtils.toString(cleanSession, "1", "0")); }
@Override public void addInFlightMessage(String clientId, int packetId, Message msg, boolean dup) { Map<String, String> map = messageToMap(msg); map.put("dup", BooleanUtils.toString(dup, "1", "0")); String r = this.script().eval(RedisLua.RPUSHLIMIT, ScriptOutputType.VALUE, new String[]{RedisKey.inFlightList(clientId)}, String.valueOf(packetId), String.valueOf(this.inFlightQueueSize)); if (r != null) this.key().del(RedisKey.inFlightMessage(clientId, Integer.parseInt(r))); this.hash().hmset(RedisKey.inFlightMessage(clientId, packetId), map); }