org.apache.commons.lang.BooleanUtils.toBoolean()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(76)

本文整理了Java中org.apache.commons.lang.BooleanUtils.toBoolean()方法的一些代码示例,展示了BooleanUtils.toBoolean()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanUtils.toBoolean()方法的具体详情如下:
包路径:org.apache.commons.lang.BooleanUtils
类名称:BooleanUtils
方法名:toBoolean

BooleanUtils.toBoolean介绍

[英]Converts an int to a boolean using the convention that zero is false.

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

[中]使用zerofalse的约定将整型转换为布尔型。

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

代码示例

代码示例来源:origin: alibaba/canal

public MessageSerializer(){
  this.filterTransactionEntry = BooleanUtils.toBoolean(System.getProperty("canal.instance.filter.transaction.entry",
    "false"));
}

代码示例来源:origin: commons-lang/commons-lang

/**
 * <p>Converts a String to a boolean (optimised for performance).</p>
 * 
 * <p><code>'true'</code>, <code>'on'</code> or <code>'yes'</code>
 * (case insensitive) will return <code>true</code>. Otherwise,
 * <code>false</code> is returned.</p>
 * 
 * <p>This method performs 4 times faster (JDK1.4) than
 * <code>Boolean.valueOf(String)</code>. However, this method accepts
 * 'on' and 'yes' as true values.
 *
 * <pre>
 *   BooleanUtils.toBoolean(null)    = false
 *   BooleanUtils.toBoolean("true")  = true
 *   BooleanUtils.toBoolean("TRUE")  = true
 *   BooleanUtils.toBoolean("tRUe")  = true
 *   BooleanUtils.toBoolean("on")    = true
 *   BooleanUtils.toBoolean("yes")   = true
 *   BooleanUtils.toBoolean("false") = false
 *   BooleanUtils.toBoolean("x gti") = false
 * </pre>
 *
 * @param str  the String to check
 * @return the boolean value of the string, <code>false</code> if no match or the String is null
 */
public static boolean toBoolean(String str) {
  return toBoolean(toBooleanObject(str));
}

代码示例来源:origin: Bukkit/Bukkit

@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
  return acceptValidatedInput(context, BooleanUtils.toBoolean(input));
}

代码示例来源:origin: pentaho/pentaho-kettle

public static boolean inProcess() {
  boolean inProcess = false;
  boolean remoteDiServer =
    BooleanUtils.toBoolean( PentahoSystem.getSystemSetting( REMOTE_DI_SERVER_INSTANCE, "false" ) ); //$NON-NLS-1$
  if ( "true".equals( PentahoSystem.getSystemSetting( SINGLE_DI_SERVER_INSTANCE, "true" ) ) ) { //$NON-NLS-1$ //$NON-NLS-2$
   inProcess = true;
  } else if ( !remoteDiServer && PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() != null ) {
   inProcess = true;
  }
  return inProcess;
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

options.setCleanSession( BooleanUtils.toBoolean( cleanSession ) );
options.setAutomaticReconnect( BooleanUtils.toBoolean( automaticReconnect ) );

代码示例来源:origin: alibaba/canal

.toBoolean(configuration.getProperties().getOrDefault("skipDupException", "true"));
rdbSyncService = new RdbSyncService(dataSource,
  threads != null ? Integer.valueOf(threads) : null,

代码示例来源:origin: alibaba/canal

autoScan = BooleanUtils.toBoolean(getProperty(properties, CanalConstants.CANAL_AUTO_SCAN));
if (autoScan) {
  defaultAction = new InstanceAction() {

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

boolean editOrderInfo = BooleanUtils.toBoolean(request.getParameter("edit-order-info"));
boolean editBillingInfo = BooleanUtils.toBoolean(request.getParameter("edit-billing"));
boolean editShippingInfo = BooleanUtils.toBoolean(request.getParameter("edit-shipping"));

代码示例来源:origin: pentaho/pentaho-kettle

getLogChannel().logDebug( "Disable Message ID is set to " + optionValue );
if ( !StringUtil.isEmpty( optionValue ) ) {
 producer.setDisableMessageID( BooleanUtils.toBoolean( optionValue ) );
getLogChannel().logDebug( "Disable Message Timestamp is set to " + optionValue );
if ( !StringUtil.isEmpty( optionValue ) ) {
 producer.setDisableMessageTimestamp( BooleanUtils.toBoolean( optionValue ) );

代码示例来源:origin: alibaba/canal

mysqlEventParser.setProfilingEnabled(false);
mysqlEventParser.setFilterTableError(parameters.getFilterTableError());
mysqlEventParser.setIsGTIDMode(BooleanUtils.toBoolean(parameters.getGtidEnable()));
  mysqlEventParser.setTsdbSnapshotExpire(parameters.getTsdbSnapshotExpire());
boolean tsdbEnable = BooleanUtils.toBoolean(parameters.getTsdbEnable());
if (tsdbEnable) {
  mysqlEventParser.setTableMetaTSDBFactory(new DefaultTableMetaTSDBFactory() {

代码示例来源:origin: naver/ngrinder

/**
 * Get the property as boolean.
 *
 * @param key property key
 * @return property boolean value
 */
public boolean getPropertyBoolean(String key) {
  return BooleanUtils.toBoolean(getProperty(key));
}

代码示例来源:origin: naver/ngrinder

/**
 * Get the parameter passed by controller. When it's executed in the
 * validation mode, always returns the given default value(false).
 *
 * @return param. false if the param was not provided.
 * @since 3.2.3
 */
public static boolean getParamBoolean() {
  return BooleanUtils.toBoolean(getParam("false"));
}

代码示例来源:origin: apache/cloudstack

setAgentClusterId(Long.parseLong((String) params.get("cluster")));
setOvm3PoolVip(String.valueOf(params.get("ovm3vip")));
setAgentInOvm3Pool(BooleanUtils.toBoolean((String) params
    .get("ovm3pool")));
setAgentInOvm3Cluster(BooleanUtils.toBoolean((String) params
    .get("ovm3cluster")));
setAgentHostname(validateParam("Hostname", (String) params.get("host")));

代码示例来源:origin: apache/cloudstack

if (BooleanUtils.toBoolean(cleanup)) {
  tryCleanupDomain(domain, ownerId);
} else {

代码示例来源:origin: apiman/apiman

protected static boolean parseBool(Map<String, String> optionsMap, String key, boolean defaultValue) {
  String value = optionsMap.get(key);
  if (value == null) {
    return defaultValue;
  } else {
    return BooleanUtils.toBoolean(value);
  }
}

代码示例来源:origin: org.mule.transports/mule-transport-http

public HttpConnector(MuleContext context)
{
  super(context);
  deprecationWarning.warn();
  singleDispatcherPerEndpoint = BooleanUtils.toBoolean(System.getProperty(SINGLE_DISPATCHER_PER_ENDPOINT_SYSTEM_PROPERTY));
  
}

代码示例来源:origin: displaytag/displaytag

/**
 * Evaluate expression in attrValueas as a boolean.
 * @param attrName attribute name
 * @param attrValue attribute value
 * @return evaluate expression of attrValue, false if attrValue is null.
 * @throws JspException exception thrown by ExpressionEvaluatorManager
 */
public boolean evalBoolean(String attrName, String attrValue) throws JspException
{
  return BooleanUtils.toBoolean((Boolean) eval(attrName, attrValue, Boolean.class));
}

代码示例来源:origin: org.fujion/fujion-core

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
  String debug = System.getProperty(DEBUG_PARAM);
  debug = debug != null ? debug : servletContext.getInitParameter(DEBUG_PARAM);
  debugEnabled = debug != null && (debug.isEmpty() || BooleanUtils.toBoolean(debug));
  
  servletContext.addFilter("themeFilter", "org.fujion.theme.ThemeServletFilter").addMappingForUrlPatterns(null, false,
      "/*");
}

代码示例来源:origin: org.andromda.cartridges/andromda-spring-cartridge

/**
 * @return findTaggedValue(SpringProfile.TAGGEDVALUEVALUE_ACTIVEMQ_OPTIMIZE_ACKNOWLEDGE)
 * @see org.andromda.cartridges.spring.metafacades.SpringServiceOperation#isOptimizeAcknowledge()
 */
protected boolean handleIsOptimizeAcknowledge()
{
  return BooleanUtils.toBoolean(ObjectUtils.toString(this.findTaggedValue(SpringProfile.TAGGEDVALUEVALUE_ACTIVEMQ_OPTIMIZE_ACKNOWLEDGE)));
}

代码示例来源:origin: pentaho/pentaho-platform

private boolean isScheduleAllowed( final Serializable repositoryId ) {
 boolean canSchedule = false;
 canSchedule = getAuthorizationPolicy().isAllowed( SCHEDULER_ACTION_NAME );
 if ( canSchedule ) {
  Map<String, Serializable> metadata = getRepository().getFileMetadata( repositoryId );
  if ( metadata.containsKey( RepositoryFile.SCHEDULABLE_KEY ) ) {
   canSchedule = BooleanUtils.toBoolean( (String) metadata.get( RepositoryFile.SCHEDULABLE_KEY ) );
  }
 }
 return canSchedule;
}

相关文章