Example usage for java.lang Boolean parseBoolean

List of usage examples for java.lang Boolean parseBoolean

Introduction

In this page you can find the example usage for java.lang Boolean parseBoolean.

Prototype

public static boolean parseBoolean(String s) 

Source Link

Document

Parses the string argument as a boolean.

Usage

From source file:com.microsoft.tfs.core.telemetry.TfsTelemetryInstrumentationInfo.java

static void initialize(final InputStream in) {
    // Default to production environment with batch uploading
    isTestEnv = false;//from  w  w w.ja  va  2 s  .c o  m
    isDeveloperMode = false;

    if (in != null) {
        try {
            final Properties props = new Properties();
            try {
                props.load(in);
                final String isTestEnvProperty = props
                        .getProperty("telemetry.instrumentation.is_test_environment"); //$NON-NLS-1$
                final String isDeveloperModeProperty = props
                        .getProperty("telemetry.instrumentation.is_developer_mode"); //$NON-NLS-1$

                // Default to production environment, all invalid inputs
                // will be resolved as "false"
                if (!StringUtil.isNullOrEmpty(isTestEnvProperty) && Boolean.parseBoolean(isTestEnvProperty)) {
                    isTestEnv = true;
                    if (!StringUtil.isNullOrEmpty(isDeveloperModeProperty)
                            && Boolean.parseBoolean(isDeveloperModeProperty)) {
                        isDeveloperMode = true;
                    }
                }
            } catch (final IOException e) {
                log.warn(MessageFormat.format("Unable to load property resource {0} with exception {1}", //$NON-NLS-1$
                        TELEMETRY_INSTRUMENTATION_PROPERTIES_RESOURCE, e));
                // suppressing exception
            }
        } finally {
            try {
                in.close();
            } catch (final IOException e) {
                log.warn(MessageFormat.format("Unable to close property resource {0} with exception {1}", //$NON-NLS-1$
                        TELEMETRY_INSTRUMENTATION_PROPERTIES_RESOURCE, e));
                // suppressing exception
            }
        }
    }
}

From source file:com.nextdoor.bender.deserializer.regex.Re2jRegexDeserializer.java

@Override
public DeserializedEvent deserialize(String raw) {
    Matcher m = this.pattern.matcher(raw);

    if (!m.matches()) {
        throw new DeserializationException("raw event does not match string");
    }//ww w .j  av  a 2s  . c o  m

    int groups = m.groupCount();
    JsonObject obj = new JsonObject();
    for (int i = 0; i < groups && i < fields.size(); i++) {
        String str = m.group(i + 1);

        ReFieldConfig field = this.fields.get(i);

        switch (field.getType()) {
        case BOOLEAN:
            obj.addProperty(field.getName(), Boolean.parseBoolean(str));
            break;
        case NUMBER:
            obj.addProperty(field.getName(), NumberUtils.createNumber(str));
            break;
        case STRING:
            obj.addProperty(field.getName(), str);
            break;
        default:
            obj.addProperty(field.getName(), str);
            break;
        }
    }

    return new GenericJsonEvent(obj);
}

From source file:coral.model.ExpData.java

public boolean isNewpage() {
    return this.containsKey("newpage") && Boolean.parseBoolean(this.get("newpage").toString());
}

From source file:net.contextfw.web.application.internal.development.ReloadingClassLoaderConf.java

private void addReloadablePackage(String str) {
    String name = StringUtils.substringBefore(str, ":");
    boolean recursive = Boolean.parseBoolean(StringUtils.substringAfter(str, ":"));

    String postfix = recursive ? "\\..+" : "\\.[^\\.]+";

    reloadablePackageNames.add(name);/* w  w w . j ava  2s .co  m*/
    reloadablePackages.add(Pattern.compile("^" + name.replaceAll("\\.", "\\.") + postfix));
}

From source file:com.netflix.dynomitemanager.sidecore.AbstractConfigSource.java

@Override
public boolean get(final String key, final boolean defaultValue) {
    final String value = get(key);
    if (value != null) {
        try {// ww w.  j  av a 2 s . c om
            return Boolean.parseBoolean(value);
        } catch (Exception e) {
            // ignore and return default
        }
    }
    return defaultValue;
}

From source file:com.hzc.framework.util.PropertiesUtil.java

public static boolean getBoolean(String key) {
    boolean result = false;
    if (StringUtils.isBlank(key) || StringUtils.isBlank(getProperties(key))) {
        result = false;/* w  w  w  .  jav  a  2s. c om*/
    } else {
        result = Boolean.parseBoolean(getProperties(key));
    }
    return result;
}

From source file:org.openmrs.module.appframework.feature.FeatureToggleProperties.java

public boolean isFeatureEnabled(String key) {
    Properties toggles = loadToggles();
    return Boolean.parseBoolean(toggles.getProperty(key, "false"));
}

From source file:com.mirth.connect.model.converters.ER7Serializer.java

public ER7Serializer(Map properties) {
    if (properties != null) {
        if (properties.get("useStrictParser") != null) {
            this.useStrictParser = Boolean.parseBoolean((String) properties.get("useStrictParser"));
        }//from w w w  .j ava2s  .  c  o  m

        if (properties.get("useStrictValidation") != null) {
            this.useStrictValidation = Boolean.parseBoolean((String) properties.get("useStrictValidation"));
        }

        if (properties.get("stripNamespaces") != null) {
            this.stripNamespaces = Boolean.parseBoolean((String) properties.get("stripNamespaces"));
        }

        if (properties.get("handleRepetitions") != null) {
            this.handleRepetitions = Boolean.parseBoolean((String) properties.get("handleRepetitions"));
        }

        if (properties.get("handleSubcomponents") != null) {
            this.handleSubcomponents = Boolean.parseBoolean((String) properties.get("handleSubcomponents"));
        }

        if (properties.get("convertLFtoCR") != null) {
            this.convertLFtoCR = Boolean.parseBoolean((String) properties.get("convertLFtoCR"));
        }
    }

    if (useStrictParser) {
        initializeParser();
    }
}

From source file:com.sdl.odata.webservice.TomcatConfiguration.java

@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
    if (Boolean.parseBoolean(httpsModeFlag)) {
        tomcat.addAdditionalTomcatConnectors(createSslConnector());
    }//  w ww.  ja va 2 s .  co  m
    return tomcat;
}

From source file:ensen.controler.DBpediaSpotlightClient.java

public List<EnsenDBpediaResource> ensenExtract(Text text) throws AnnotationException {

    if (Boolean.parseBoolean(PropertiesManager.getProperty("UseDBpediaSpotlightCandidate")))
        return extractCandidats(text);
    else//w  w w.j  av  a2  s  .c o  m
        return extractAnnotation(text, PropertiesManager.getProperty("CONFIDENCE"),
                PropertiesManager.getProperty("SUPPORT"), "");

}