Example usage for org.apache.commons.lang BooleanUtils toBooleanDefaultIfNull

List of usage examples for org.apache.commons.lang BooleanUtils toBooleanDefaultIfNull

Introduction

In this page you can find the example usage for org.apache.commons.lang BooleanUtils toBooleanDefaultIfNull.

Prototype

public static boolean toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull) 

Source Link

Document

Converts a Boolean to a boolean handling null.

 BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE, false) = true BooleanUtils.toBooleanDefaultIfNull(Boolean.FALSE, true) = false BooleanUtils.toBooleanDefaultIfNull(null, true)          = true 

Usage

From source file:com.alibaba.rocketmq.storm.internal.tools.ConfigUtils.java

public static Config init(String configFile) {
    Config config = new Config();
    //1.//  w  ww .j a va 2s  .  com
    Properties prop = ConfigUtils.getResource(configFile);
    for (Entry<Object, Object> entry : prop.entrySet()) {
        config.put((String) entry.getKey(), entry.getValue());
    }
    //2.
    String topic = (String) config.get(ConfigUtils.CONFIG_TOPIC);
    String consumerGroup = (String) config.get(ConfigUtils.CONFIG_CONSUMER_GROUP);
    String topicTag = (String) config.get(ConfigUtils.CONFIG_TOPIC_TAG);
    //Integer pullBatchSize = (Integer) config.get(ConfigUtils.CONFIG_PREFETCH_SIZE);
    Integer pullBatchSize = Integer.parseInt((String) config.get(ConfigUtils.CONFIG_PREFETCH_SIZE));

    RocketMQConfig mqConfig = new RocketMQConfig(consumerGroup, topic, topicTag);

    if (pullBatchSize != null && pullBatchSize > 0) {
        mqConfig.setPullBatchSize(pullBatchSize);
    }

    boolean ordered = BooleanUtils
            .toBooleanDefaultIfNull(Boolean.valueOf((String) (config.get("rocketmq.spout.ordered"))), false);
    mqConfig.setOrdered(ordered);

    config.put(CONFIG_ROCKETMQ, mqConfig);
    return config;
}

From source file:com.adaptris.core.services.cache.AddToCacheService.java

public boolean enforceSerializable() {
    return BooleanUtils.toBooleanDefaultIfNull(getEnforceSerializable(), false);
}

From source file:com.adaptris.core.services.cache.CacheEntryEvaluator.java

boolean errorOnEmptyValue() {
    return BooleanUtils.toBooleanDefaultIfNull(getErrorOnEmptyValue(), true);
}

From source file:com.adaptris.core.ServiceCollectionImp.java

@Override
public boolean continueOnFailure() {
    return BooleanUtils.toBooleanDefaultIfNull(getContinueOnFail(), false);
}

From source file:com.adaptris.core.http.jetty.ResponseProducerImpl.java

protected boolean forwardConnectionException() {
    return BooleanUtils.toBooleanDefaultIfNull(getForwardConnectionException(), false);
}

From source file:com.adaptris.core.services.splitter.PoolingMessageSplitterService.java

boolean warmStart() {
    return BooleanUtils.toBooleanDefaultIfNull(getWarmStart(), false);
}

From source file:com.adaptris.core.http.jetty.ResponseProducerImpl.java

protected boolean flushBuffers() {
    return BooleanUtils.toBooleanDefaultIfNull(getFlushBuffer(), true);
}

From source file:com.adaptris.core.AdaptrisMessageWorkerImp.java

@Override
public boolean isTrackingEndpoint() {
    return BooleanUtils.toBooleanDefaultIfNull(getIsTrackingEndpoint(), false);
}

From source file:com.adaptris.util.text.xml.XmlTransformerFactoryImpl.java

private boolean failOnRecoverableError() {
    return BooleanUtils.toBooleanDefaultIfNull(getFailOnRecoverableError(), true);
}

From source file:com.adaptris.core.services.splitter.MessageSplitterServiceImp.java

public boolean ignoreSplitMessageFailures() {
    return BooleanUtils.toBooleanDefaultIfNull(getIgnoreSplitMessageFailures(), false);
}