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

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

Best Java code snippets using org.apache.commons.lang3.BooleanUtils.toBoolean (Showing top 20 results out of 1,206)

  • 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: BroadleafCommerce/BroadleafCommerce

@Override
public boolean isPasswordChangeRequired() {
  return BooleanUtils.toBoolean(passwordChangeRequired);
}
origin: BroadleafCommerce/BroadleafCommerce

@Override
public boolean isDeactivated() {
  return BooleanUtils.toBoolean(deactivated);
}
origin: alibaba/jvm-sandbox

/**
 * 是否启用Unsafe功能
 *
 * @return unsafe.enable
 */
public boolean isEnableUnsafe() {
  return BooleanUtils.toBoolean(featureMap.get(KEY_UNSAFE_ENABLE));
}
origin: alibaba/jvm-sandbox

/**
 * 是否启用事件池
 *
 * @return event.pool.enable
 */
public boolean isEventPoolEnable() {
  return BooleanUtils.toBoolean(featureMap.get(KEY_EVENT_POOL_ENABLE));
}
origin: wuyouzhuguli/FEBS-Shiro

@Override
public void init(FilterConfig filterConfig) {
  logger.info("------------ xss filter init ------------");
  String isIncludeRichText = filterConfig.getInitParameter("isIncludeRichText");
  if (StringUtils.isNotBlank(isIncludeRichText)) {
    flag = BooleanUtils.toBoolean(isIncludeRichText);
  }
  String temp = filterConfig.getInitParameter("excludes");
  if (temp != null) {
    String[] url = temp.split(",");
    excludes.addAll(Arrays.asList(url));
  }
}
origin: BroadleafCommerce/BroadleafCommerce

/**
 * Used for linking in toOneLookup fields as well as linking to the entity via a 'name' field
 */
public boolean getCanLinkToExternalEntity() {
  boolean isAddlFK = SupportedFieldType.ADDITIONAL_FOREIGN_KEY.toString().equals(fieldType);
  boolean canLinkToExternalEntity = BooleanUtils.toBoolean(this.canLinkToExternalEntity);
  return isAddlFK && canLinkToExternalEntity;
}
origin: gocd/gocd

public void setConfigAttributes(Object attributes) {
  Map attributeMap = (Map) attributes;
  this.name = (String) attributeMap.get(EnvironmentVariableConfig.NAME);
  String value = (String) attributeMap.get(EnvironmentVariableConfig.VALUE);
  if (StringUtils.isBlank(name) && StringUtils.isBlank(value)) {
    throw new IllegalArgumentException(String.format("Need not null/empty name & value %s:%s", this.name, value));
  }
  this.isSecure = BooleanUtils.toBoolean((String) attributeMap.get(EnvironmentVariableConfig.SECURE));
  Boolean isChanged = BooleanUtils.toBoolean((String) attributeMap.get(EnvironmentVariableConfig.ISCHANGED));
  if (isSecure) {
    this.encryptedValue = isChanged ? new EncryptedVariableValueConfig(encrypt(value)) : new EncryptedVariableValueConfig(value);
  } else {
    this.value = new VariableValueConfig(value);
  }
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void test_toBoolean_Integer_Integer_Integer_nullValue() {
  BooleanUtils.toBoolean(null, Integer.valueOf(6), Integer.valueOf(7));
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toBoolean_String_String_String() {
  assertTrue(BooleanUtils.toBoolean(null, null, "N"));
  assertFalse(BooleanUtils.toBoolean(null, "Y", null));
  assertTrue(BooleanUtils.toBoolean("Y", "Y", "N"));
  assertTrue(BooleanUtils.toBoolean("Y", new String("Y"), new String("N")));
  assertFalse(BooleanUtils.toBoolean("N", "Y", "N"));
  assertFalse(BooleanUtils.toBoolean("N", new String("Y"), new String("N")));
  assertTrue(BooleanUtils.toBoolean((String) null, null, null));
  assertTrue(BooleanUtils.toBoolean("Y", "Y", "Y"));
  assertTrue(BooleanUtils.toBoolean("Y", new String("Y"), new String("Y")));
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void test_toBoolean_int_int_int_noMatch() {
  BooleanUtils.toBoolean(8, 6, 7);
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void test_toBoolean_Integer_Integer_Integer_noMatch() {
  BooleanUtils.toBoolean(Integer.valueOf(8), Integer.valueOf(6), Integer.valueOf(7));
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void test_toBoolean_String_String_String_noMatch() {
  BooleanUtils.toBoolean("X", "Y", "N");
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void test_toBoolean_String_String_String_nullValue() {
  BooleanUtils.toBoolean(null, "Y", "N");
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toBoolean_Integer_Integer_Integer() {
  final Integer six = Integer.valueOf(6);
  final Integer seven = Integer.valueOf(7);
  assertTrue(BooleanUtils.toBoolean(null, null, seven));
  assertFalse(BooleanUtils.toBoolean(null, six, null));
  assertTrue(BooleanUtils.toBoolean(Integer.valueOf(6), six, seven));
  assertFalse(BooleanUtils.toBoolean(Integer.valueOf(7), six, seven));
}
origin: apache/incubator-gobblin

protected boolean areSingleBranchTasksSynchronous(TaskContext taskContext) {
 return BooleanUtils.toBoolean(taskContext.getTaskState()
     .getProp(TaskConfigurationKeys.TASK_IS_SINGLE_BRANCH_SYNCHRONOUS, TaskConfigurationKeys.DEFAULT_TASK_IS_SINGLE_BRANCH_SYNCHRONOUS));
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toBoolean_int() {
  assertTrue(BooleanUtils.toBoolean(1));
  assertTrue(BooleanUtils.toBoolean(-1));
  assertFalse(BooleanUtils.toBoolean(0));
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toBoolean_Boolean() {
  assertTrue(BooleanUtils.toBoolean(Boolean.TRUE));
  assertFalse(BooleanUtils.toBoolean(Boolean.FALSE));
  assertFalse(BooleanUtils.toBoolean((Boolean) null));
}
origin: org.apache.commons/commons-lang3

@Test
public void test_toBoolean_int_int_int() {
  assertTrue(BooleanUtils.toBoolean(6, 6, 7));
  assertFalse(BooleanUtils.toBoolean(7, 6, 7));
}
origin: alibaba/jvm-sandbox

@Http("/flush")
public void flush(final HttpServletRequest req,
         final HttpServletResponse resp) throws ModuleException, IOException {
  final String isForceString = getParamWithDefault(req, "force", EMPTY);
  final boolean isForce = BooleanUtils.toBoolean(isForceString);
  moduleManager.flush(isForce);
  output(resp.getWriter(), "module flush finished, total=%s;", moduleManager.list().size());
}
origin: alibaba/nacos

private IpAddress getIPAddress(HttpServletRequest request) {
  String ip = WebUtils.required(request, "ip");
  String port = WebUtils.required(request, "port");
  String weight = WebUtils.optional(request, "weight", "1");
  String cluster = WebUtils.optional(request, "cluster", StringUtils.EMPTY);
  if (StringUtils.isEmpty(cluster)) {
    cluster = WebUtils.optional(request, "clusterName", UtilsAndCommons.DEFAULT_CLUSTER_NAME);
  }
  boolean enabled = BooleanUtils.toBoolean(WebUtils.optional(request, "enable", "true"));
  IpAddress ipAddress = new IpAddress();
  ipAddress.setPort(Integer.parseInt(port));
  ipAddress.setIp(ip);
  ipAddress.setWeight(Double.parseDouble(weight));
  ipAddress.setClusterName(cluster);
  ipAddress.setEnabled(enabled);
  return ipAddress;
}
org.apache.commons.lang3BooleanUtilstoBoolean

Javadoc

Converts an int to a boolean using the convention that zerois false.

 
BooleanUtils.toBoolean(0) = false 
BooleanUtils.toBoolean(1) = true 
BooleanUtils.toBoolean(2) = true 

Popular methods of BooleanUtils

  • 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"
  • 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

  • Making http post requests using okhttp
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
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