Codota Logo
BooleanUtils.toString
Code IndexAdd Codota to your IDE (free)

How to use
toString
method
in
org.apache.commons.lang3.BooleanUtils

Best Java code snippets using org.apache.commons.lang3.BooleanUtils.toString (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: org.apache.commons/commons-lang3

/**
 * <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");
}
origin: org.apache.commons/commons-lang3

/**
 * <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");
}
origin: org.apache.commons/commons-lang3

/**
 * <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");
}
origin: org.apache.commons/commons-lang3

/**
 * <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);
}
origin: org.apache.commons/commons-lang3

/**
 * <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);
}
origin: org.apache.commons/commons-lang3

/**
 * <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);
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toString_Boolean_String_String_String() {
  assertEquals("U", BooleanUtils.toString(null, "Y", "N", "U"));
  assertEquals("Y", BooleanUtils.toString(Boolean.TRUE, "Y", "N", "U"));
  assertEquals("N", BooleanUtils.toString(Boolean.FALSE, "Y", "N", "U"));
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toString_boolean_String_String_String() {
  assertEquals("Y", BooleanUtils.toString(true, "Y", "N"));
  assertEquals("N", BooleanUtils.toString(false, "Y", "N"));
}
origin: de.knightsoft-net/gwt-commons-lang3

/**
 * <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");
}
origin: io.virtdata/virtdata-lib-curves4

/**
 * <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");
}
origin: io.virtdata/virtdata-lib-realer

/**
 * <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");
}
origin: de.knightsoft-net/gwt-commons-lang3

/**
 * <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");
}
origin: io.virtdata/virtdata-lib-curves4

/**
 * <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");
}
origin: anylogic/alogic

/**
 * 设置指定属性的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"));
  }
}

origin: org.apereo.cas/cas-server-core-util-api

  @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;
  }
}
origin: org.apereo.cas/cas-server-support-oauth

@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;
}
origin: org.apereo.cas/cas-server-support-surrogate-authentication

  @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()};
  }
}
origin: org.apereo.cas/cas-server-support-pac4j-core

  @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()};
  }
}
origin: longkerdandy/mithqtt

@Override
public void updateSessionExist(String clientId, boolean cleanSession) {
  this.string().set(RedisKey.session(clientId), BooleanUtils.toString(cleanSession, "1", "0"));
}
origin: longkerdandy/mithqtt

@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);
}
org.apache.commons.lang3BooleanUtilstoString

Javadoc

Converts a Boolean to a String returning one of the input Strings.

 
BooleanUtils.toString(Boolean.TRUE, "true", "false", null)   = "true" 
BooleanUtils.toString(Boolean.FALSE, "true", "false", null)  = "false" 
BooleanUtils.toString(null, "true", "false", null)           = null; 

Popular methods of BooleanUtils

  • toBoolean
    Converts a String to a Boolean throwing an exception if no match found. BooleanUtils.toBoolean("t
  • isTrue
    Checks if a Boolean value is true, handling null by returning false. BooleanUtils.isTrue(Boolean.
  • toBooleanObject
    Converts a String to a Boolean throwing an exception if no match. NOTE: This returns null and will
  • isFalse
    Checks if a Boolean value is false, handling null by returning false. BooleanUtils.isFalse(Boolea
  • isNotTrue
    Checks if a Boolean value is not true, handling null by returning true. BooleanUtils.isNotTrue(Bo
  • toStringTrueFalse
    Converts a boolean to a String returning 'true'or 'false'. BooleanUtils.toStringTrueFalse(true)
  • toBooleanDefaultIfNull
    Converts a Boolean to a boolean handling null. BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE,
  • isNotFalse
    Checks if a Boolean value is not false, handling null by returning true. BooleanUtils.isNotFalse(
  • or
    Performs an or on a set of booleans. BooleanUtils.or(true, true) = true BooleanUtils.or
  • and
    Performs an and on a set of booleans. BooleanUtils.and(true, true) = true BooleanUtils.a
  • toStringYesNo
    Converts a boolean to a String returning 'yes'or 'no'. BooleanUtils.toStringYesNo(true) = "yes"
  • xor
    Performs an xor on a set of booleans. BooleanUtils.xor(true, true) = false BooleanUtils.xor(fa
  • toStringYesNo,
  • xor,
  • toInteger,
  • compare,
  • negate,
  • toStringOnOff,
  • <init>,
  • toIntegerObject

Popular in Java

  • Running tasks concurrently on multiple threads
  • addToBackStack (FragmentTransaction)
  • requestLocationUpdates (LocationManager)
  • getSystemService (Context)
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Path (java.nio.file)
  • ImageIO (javax.imageio)
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now