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

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

Introduction

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

Prototype

public static boolean toBoolean(String str) 

Source Link

Document

Converts a String to a boolean (optimised for performance).

'true', 'on' or 'yes' (case insensitive) will return true.

Usage

From source file:com.redhat.rhn.domain.common.SatConfigFactory.java

/**
 * return satellite configuration boolean value for a specified key
 * @param key key/*from www  . j  a v a2s.com*/
 * @return value boolean value
 */
public static boolean getSatConfigBooleanValue(String key) {
    return BooleanUtils.toBoolean(getSatConfigValue(key));
}

From source file:de.hybris.platform.acceleratorfacades.device.populators.DeviceDataUiExperiencePopulator.java

@Override
public void populate(final DeviceData deviceData, final UiExperienceData uiExperienceData)
        throws ConversionException {
    if (BooleanUtils.toBoolean(deviceData.getDesktopBrowser())) {
        uiExperienceData.setLevel(UiExperienceLevel.DESKTOP);
    } else if (BooleanUtils.toBoolean(deviceData.getMobileBrowser())) {
        uiExperienceData.setLevel(UiExperienceLevel.MOBILE);
    } else if (BooleanUtils.toBoolean(deviceData.getTabletBrowser())) {
        uiExperienceData.setLevel(UiExperienceLevel.DESKTOP);
    } else {//from   ww  w.j  a va2  s.c  om
        // Default to the DESKTOP
        uiExperienceData.setLevel(UiExperienceLevel.DESKTOP);
    }
}

From source file:com.moreopen.monitor.console.utils.AppSettings.java

public boolean getBoolean(String key) {
    return BooleanUtils.toBoolean(this.getSetting(key));
}

From source file:io.apiman.common.config.options.AbstractOptions.java

protected static boolean parseBool(Map<String, String> optionsMap, String key, boolean defaultValue) {
    String value = optionsMap.get(key);
    if (value == null) {
        return defaultValue;
    } else {/*from www.  jav  a2 s.  c  om*/
        return BooleanUtils.toBoolean(value);
    }
}

From source file:com.bstek.dorado.console.ConsoleConfigure.java

/**
 * boolean???/*from w  w  w.j av a 2 s .com*/
 * 
 * @param key
 *            ???
 */
public static boolean getBoolean(String key) {
    Object value = get(key);
    return (value instanceof Boolean) ? ((Boolean) value).booleanValue()
            : BooleanUtils.toBoolean((value == null) ? null : value.toString());
}

From source file:com.mindquarry.webapp.ajax.LightboxRequestSelector.java

public boolean select(String expression, Object selectorContext) {
    boolean test = BooleanUtils.toBoolean(expression);
    return test == ((Boolean) selectorContext).booleanValue();
}

From source file:com.zyeeda.framework.web.CharacterEncodingFilter.java

@Override
public void init(FilterConfig config) throws ServletException {
    encoding = config.getInitParameter("encoding");
    forceEncoding = BooleanUtils.toBoolean(config.getInitParameter("forceEncoding"));
    if (StringUtils.isBlank(encoding)) {
        this.setEncoding("UTF-8");
    }/*from   w w  w . ja v  a  2  s .c  o m*/
}

From source file:com.bstek.dorado.data.config.xml.PreloadDataTypeParser.java

@Override
protected Object doParse(Node node, ParseContext context) throws Exception {
    DataParseContext dataContext = (DataParseContext) context;
    Element element = ((Element) node);

    String name = element.getAttribute(XmlConstants.ATTRIBUTE_NAME);
    if (StringUtils.isEmpty(name)) {
        throw new XmlParseException("[" + XmlConstants.ATTRIBUTE_NAME + "] attribute can not be empty", element,
                context);//ww w.ja va  2s  . co  m
    }

    Map<String, NodeWrapper> configuredDataTypes = dataContext.getConfiguredDataTypes();
    if (configuredDataTypes.containsKey(name)) {
        boolean overwrite = BooleanUtils.toBoolean(element.getAttribute(DataXmlConstants.ATTRIBUTE_OVERWRITE));
        if (!overwrite) {
            throw new XmlParseException(DataXmlConstants.DATA_TYPE + " [" + name + "] is not unique!", element,
                    context);
        }
    }

    configuredDataTypes.put(name, new NodeWrapper(node, context.getResource()));
    return null;
}

From source file:jp.primecloud.auto.tool.management.iaasgw.IaasGatewayScriptService.java

public IaasGatewayScriptService(Long userNo, Long platformNo, String platformName) throws AutoException {
    try {//  w  ww. j  a  v a2  s. co m
        log.info("IaasGatewayScriptService before context.getBean(iaasGatewayFactory)");
        Integer interval = Integer.parseInt(Config.getProperty("aws.describeInterval"));
        Boolean sync = BooleanUtils.toBoolean(Config.getProperty("aws.synchronized"));
        IaasGatewayFactory factory = new IaasGatewayFactory(interval, sync);
        gateway = factory.createIaasGateway(userNo, platformNo);
        this.platformName = platformName;
    } catch (Exception e) {
        e.printStackTrace();
        log.error(e.getMessage(), e);
    }
}

From source file:com.adaptris.core.services.jdbc.BooleanStatementParameter.java

@Override
protected Boolean convertToType(Object o) {
    return Boolean.valueOf(BooleanUtils.toBoolean((String) o));
}