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

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

Best Java code snippets using org.apache.commons.lang3.BooleanUtils.toInteger (Showing top 11 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>Returns the number of inheritance hops between two classes.</p>
   *
   * @param child the child class, may be {@code null}
   * @param parent the parent class, may be {@code null}
   * @return the number of generations between the child and parent; 0 if the same class;
   * -1 if the classes are not related as child and parent (includes where either class is null)
   * @since 3.2
   */
  public static int distance(final Class<?> child, final Class<?> parent) {
    if (child == null || parent == null) {
      return -1;
    }

    if (child.equals(parent)) {
      return 0;
    }

    final Class<?> cParent = child.getSuperclass();
    int d = BooleanUtils.toInteger(parent.equals(cParent));

    if (d == 1) {
      return d;
    }
    d += distance(cParent, parent);
    return d > 0 ? d + 1 : -1;
  }
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toInteger_Boolean_int_int_int() {
  assertEquals(6, BooleanUtils.toInteger(Boolean.TRUE, 6, 7, 8));
  assertEquals(7, BooleanUtils.toInteger(Boolean.FALSE, 6, 7, 8));
  assertEquals(8, BooleanUtils.toInteger(null, 6, 7, 8));
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toInteger_boolean_int_int() {
  assertEquals(6, BooleanUtils.toInteger(true, 6, 7));
  assertEquals(7, BooleanUtils.toInteger(false, 6, 7));
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toInteger_boolean() {
  assertEquals(1, BooleanUtils.toInteger(true));
  assertEquals(0, BooleanUtils.toInteger(false));
}
origin: org.jasig.cas/cas-server-integration-ehcache

@Override
public int sessionCount() {
  return BooleanUtils.toInteger(this.supportRegistryState, this.ticketGrantingTicketsCache
      .getKeysWithExpiryCheck().size(), super.sessionCount());
}
origin: org.jasig.cas/cas-server-integration-ehcache

  @Override
  public int serviceTicketCount() {
    return BooleanUtils.toInteger(this.supportRegistryState, this.serviceTicketsCache.getKeysWithExpiryCheck()
        .size(), super.serviceTicketCount());
  }
}
origin: io.virtdata/virtdata-lib-realer

  /**
   * <p>Returns the number of inheritance hops between two classes.</p>
   *
   * @param child the child class, may be {@code null}
   * @param parent the parent class, may be {@code null}
   * @return the number of generations between the child and parent; 0 if the same class;
   * -1 if the classes are not related as child and parent (includes where either class is null)
   * @since 3.2
   */
  public static int distance(final Class<?> child, final Class<?> parent) {
    if (child == null || parent == null) {
      return -1;
    }

    if (child.equals(parent)) {
      return 0;
    }

    final Class<?> cParent = child.getSuperclass();
    int d = BooleanUtils.toInteger(parent.equals(cParent));

    if (d == 1) {
      return d;
    }
    d += distance(cParent, parent);
    return d > 0 ? d + 1 : -1;
  }
}
origin: io.virtdata/virtdata-lib-curves4

  /**
   * <p>Returns the number of inheritance hops between two classes.</p>
   *
   * @param child the child class, may be {@code null}
   * @param parent the parent class, may be {@code null}
   * @return the number of generations between the child and parent; 0 if the same class;
   * -1 if the classes are not related as child and parent (includes where either class is null)
   * @since 3.2
   */
  public static int distance(final Class<?> child, final Class<?> parent) {
    if (child == null || parent == null) {
      return -1;
    }

    if (child.equals(parent)) {
      return 0;
    }

    final Class<?> cParent = child.getSuperclass();
    int d = BooleanUtils.toInteger(parent.equals(cParent));

    if (d == 1) {
      return d;
    }
    d += distance(cParent, parent);
    return d > 0 ? d + 1 : -1;
  }
}
origin: de.knightsoft-net/gwt-commons-lang3

  /**
   * <p>Returns the number of inheritance hops between two classes.</p>
   *
   * @param child the child class, may be {@code null}
   * @param parent the parent class, may be {@code null}
   * @return the number of generations between the child and parent; 0 if the same class;
   * -1 if the classes are not related as child and parent (includes where either class is null)
   * @since 3.2
   */
  public static int distance(final Class<?> child, final Class<?> parent) {
    if (child == null || parent == null) {
      return -1;
    }

    if (child.equals(parent)) {
      return 0;
    }

    final Class<?> cParent = child.getSuperclass();
    int d = BooleanUtils.toInteger(parent.equals(cParent));

    if (d == 1) {
      return d;
    }
    d += distance(cParent, parent);
    return d > 0 ? d + 1 : -1;
  }
}
origin: com.github.binarywang/weixin-java-mp

@Override
public JsonElement serialize(WxMpMaterialNews.WxMpMaterialNewsArticle article, Type typeOfSrc, JsonSerializationContext context) {
 JsonObject articleJson = new JsonObject();
 articleJson.addProperty("thumb_media_id", article.getThumbMediaId());
 articleJson.addProperty("thumb_url", article.getThumbUrl());
 articleJson.addProperty("title", article.getTitle());
 articleJson.addProperty("content", article.getContent());
 if (null != article.getAuthor()) {
  articleJson.addProperty("author", article.getAuthor());
 }
 if (null != article.getContentSourceUrl()) {
  articleJson.addProperty("content_source_url", article.getContentSourceUrl());
 }
 if (null != article.getDigest()) {
  articleJson.addProperty("digest", article.getDigest());
 }
 articleJson.addProperty("show_cover_pic", article.isShowCoverPic() ? "1" : "0");
 if (null != article.getUrl()) {
  articleJson.addProperty("url", article.getUrl());
 }
 if (null != article.getNeedOpenComment()) {
  articleJson.addProperty("need_open_comment",
   BooleanUtils.toInteger(article.getNeedOpenComment(), 1, 0));
 }
 if (null != article.getOnlyFansCanComment()) {
  articleJson.addProperty("only_fans_can_comment",
   BooleanUtils.toInteger(article.getOnlyFansCanComment(), 1, 0));
 }
 return articleJson;
}
origin: binarywang/WxJava

@Override
public JsonElement serialize(WxMpMaterialNews.WxMpMaterialNewsArticle article, Type typeOfSrc, JsonSerializationContext context) {
 JsonObject articleJson = new JsonObject();
 articleJson.addProperty("thumb_media_id", article.getThumbMediaId());
 articleJson.addProperty("thumb_url", article.getThumbUrl());
 articleJson.addProperty("title", article.getTitle());
 articleJson.addProperty("content", article.getContent());
 if (null != article.getAuthor()) {
  articleJson.addProperty("author", article.getAuthor());
 }
 if (null != article.getContentSourceUrl()) {
  articleJson.addProperty("content_source_url", article.getContentSourceUrl());
 }
 if (null != article.getDigest()) {
  articleJson.addProperty("digest", article.getDigest());
 }
 articleJson.addProperty("show_cover_pic", article.isShowCoverPic() ? "1" : "0");
 if (null != article.getUrl()) {
  articleJson.addProperty("url", article.getUrl());
 }
 if (null != article.getNeedOpenComment()) {
  articleJson.addProperty("need_open_comment",
   BooleanUtils.toInteger(article.getNeedOpenComment(), 1, 0));
 }
 if (null != article.getOnlyFansCanComment()) {
  articleJson.addProperty("only_fans_can_comment",
   BooleanUtils.toInteger(article.getOnlyFansCanComment(), 1, 0));
 }
 return articleJson;
}
org.apache.commons.lang3BooleanUtilstoInteger

Javadoc

Converts a Boolean to an int specifying the conversion values.

 
BooleanUtils.toInteger(Boolean.TRUE, 1, 0, 2)  = 1 
BooleanUtils.toInteger(Boolean.FALSE, 1, 0, 2) = 0 
BooleanUtils.toInteger(null, 1, 0, 2)          = 2 

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,
  • toString
    Converts a boolean to a String returning one of the input Strings. BooleanUtils.toString(true, "t
  • 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"
  • and,
  • toStringYesNo,
  • xor,
  • 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