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:it.f2informatica.webapp.controller.AuthenticationController.java

@RequestMapping(value = "/login", method = RequestMethod.GET)
public String loginPage(@RequestParam(value = "error", required = false) String error, ModelMap modelMap) {

    if (error != null) {
        if (Boolean.parseBoolean(error)) {
            modelMap.addAttribute("hasErrors", true);
        } else {/*from  w  ww  .jav  a  2s . co  m*/
            return "redirect:/login";
        }
    }

    return "login/login";
}

From source file:com.taobao.common.store.util.MyMBeanServer.java

private MyMBeanServer() {
    try {/*  w w w.ja  va 2  s.  co  m*/
        final boolean useJmx = Boolean.parseBoolean(System.getProperty("store4j.useJMX", "false"));
        if (useJmx) {
            mbs = ManagementFactory.getPlatformMBeanServer();
        }
    } catch (final Exception e) {
        log.error("create MBServer error", e);
    }
}

From source file:architecture.ee.web.struts2.interceptor.ExtendedPrepareInterceptor.java

public void setAlwaysInvokePrepare(String alwaysInvokePrepare) {
    this.alwaysInvokePrepare = Boolean.parseBoolean(alwaysInvokePrepare);
}

From source file:com.clican.pluto.dataprocess.spring.parser.CollectionIteratorProcessorParser.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) {
    this.setBeanDefinitionStringProperty("elementName", beanDef, element);
    this.setBeanDefinitionStringProperty("collectionName", beanDef, element);
    String commit = element.getAttribute("stepCommit");
    if (StringUtils.isNotEmpty(commit)) {
        beanDef.getPropertyValues().addPropertyValue("stepCommit", Boolean.parseBoolean(commit));
    }//from   ww w.java 2  s. c  o m
    String iteratorProcessors = element.getAttribute("iteratorProcessors");
    List iteratorProcessorList = new ManagedList();
    for (String nextDataProcess : iteratorProcessors.split(",")) {
        nextDataProcess = nextDataProcess.trim();
        iteratorProcessorList.add(new RuntimeBeanReference(nextDataProcess));
    }
    beanDef.getPropertyValues().addPropertyValue("iteratorProcessors", iteratorProcessorList);
}

From source file:com.gopivotal.cloudfoundry.test.core.InitializationUtils.java

/**
 * Generates a {@link RuntimeException} if the {@code FAIL_INIT} environment variable is {@code true}. Otherwise
 * does nothing./*from   w  ww .j av a2 s  .  co  m*/
 */
public void fail() {
    String value = this.environment.get("FAIL_INIT");

    if ((value != null) && Boolean.parseBoolean(value)) {
        System.err.println("$FAIL_INIT caused initialization to fail");
        throw new RuntimeException("$FAIL_INIT caused initialization to fail");
    }
}

From source file:com.haulmont.cuba.gui.xml.layout.loaders.SourceCodeEditorLoader.java

@Override
public void loadComponent() {
    super.loadComponent();

    loadTabIndex(resultComponent, element);

    loadMode(resultComponent, element);/*w  w w .  j ava 2 s  .  c o m*/

    String showGutter = element.attributeValue("showGutter");
    if (StringUtils.isNotEmpty(showGutter)) {
        resultComponent.setShowGutter(Boolean.parseBoolean(showGutter));
    }

    String printMargin = element.attributeValue("printMargin");
    if (StringUtils.isNotEmpty(printMargin)) {
        resultComponent.setShowPrintMargin(Boolean.parseBoolean(printMargin));
    }

    String printMarginColumn = element.attributeValue("printMarginColumn");
    if (StringUtils.isNotEmpty(printMarginColumn)) {
        resultComponent.setPrintMarginColumn(Integer.parseInt(printMarginColumn));
    }

    String highlightActiveLine = element.attributeValue("highlightActiveLine");
    if (StringUtils.isNotEmpty(highlightActiveLine)) {
        resultComponent.setHighlightActiveLine(Boolean.parseBoolean(highlightActiveLine));
    }

    String handleTabKey = element.attributeValue("handleTabKey");
    if (StringUtils.isNotEmpty("handleTabKey")) {
        resultComponent.setHandleTabKey(Boolean.parseBoolean(handleTabKey));
    }
}

From source file:com.cloudera.director.google.TestFixture.java

public static TestFixture newTestFixture(boolean sshPublicKeyAndUserNameAreRequired) throws IOException {
    String projectId = TestUtils.readRequiredSystemProperty("GCP_PROJECT_ID");
    String jsonKey = TestUtils.readFileIfSpecified(System.getProperty("JSON_KEY_PATH", ""));

    // If the path to a json key file was not provided, check if the key was passed explicitly.
    if (jsonKey == null) {
        String jsonKeyInline = System.getProperty("JSON_KEY_INLINE", "");

        if (!jsonKeyInline.isEmpty()) {
            // If so, we must base64-decode it.
            jsonKey = new String(Base64.decodeBase64(jsonKeyInline));
        }//from w  w  w.  ja  v a  2 s.co m
    }

    String sshPublicKey = null;
    String userName = null;

    if (sshPublicKeyAndUserNameAreRequired) {
        sshPublicKey = TestUtils.readFile(TestUtils.readRequiredSystemProperty("SSH_PUBLIC_KEY_PATH"),
                Charset.defaultCharset());
        userName = TestUtils.readRequiredSystemProperty("SSH_USER_NAME");
    }

    boolean haltAfterAllocation = Boolean.parseBoolean(System.getProperty("HALT_AFTER_ALLOCATION", "false"));

    return new TestFixture(projectId, jsonKey, sshPublicKey, userName, haltAfterAllocation);
}

From source file:com.bibisco.manager.TipManager.java

public static TipSettings load() {

    TipSettings lTipSettings = null;/*  w w  w.  j  av  a 2s  .  com*/
    List<Properties> lListProperties = null;

    mLog.debug("Start loadTipSettings()");

    SqlSessionFactory lSqlSessionFactory = SqlSessionFactoryManager.getInstance().getSqlSessionFactoryBibisco();
    SqlSession lSqlSession = lSqlSessionFactory.openSession();
    try {
        PropertiesMapper lPropertiesMapper = lSqlSession.getMapper(PropertiesMapper.class);
        lListProperties = lPropertiesMapper.selectByExample(new PropertiesExample());
    } catch (Throwable t) {
        mLog.error(t);
        throw new BibiscoException(t, BibiscoException.SQL_EXCEPTION);
    } finally {
        lSqlSession.close();
    }

    lTipSettings = new TipSettings();
    for (Properties lProperties : lListProperties) {
        if (lProperties.getProperty().equalsIgnoreCase("sceneTip")) {
            lTipSettings.setSceneTip(Boolean.parseBoolean(lProperties.getValue()));
            continue;
        } else if (lProperties.getProperty().equalsIgnoreCase("chaptersdndTip")) {
            lTipSettings.getDndTipMap().put(lProperties.getProperty(),
                    Boolean.parseBoolean(lProperties.getValue()));
            continue;
        } else if (lProperties.getProperty().equalsIgnoreCase("scenesdndTip")) {
            lTipSettings.getDndTipMap().put(lProperties.getProperty(),
                    Boolean.parseBoolean(lProperties.getValue()));
            continue;
        } else if (lProperties.getProperty().equalsIgnoreCase("locationsdndTip")) {
            lTipSettings.getDndTipMap().put(lProperties.getProperty(),
                    Boolean.parseBoolean(lProperties.getValue()));
            continue;
        } else if (lProperties.getProperty().equalsIgnoreCase("charactersdndTip")) {
            lTipSettings.getDndTipMap().put(lProperties.getProperty(),
                    Boolean.parseBoolean(lProperties.getValue()));
            continue;
        } else if (lProperties.getProperty().equalsIgnoreCase("strandsdndTip")) {
            lTipSettings.getDndTipMap().put(lProperties.getProperty(),
                    Boolean.parseBoolean(lProperties.getValue()));
            continue;
        } else if (lProperties.getProperty().equalsIgnoreCase("socialMediaTip")) {
            lTipSettings.setSocialMediaTip(Boolean.parseBoolean(lProperties.getValue()));
            continue;
        } else if (lProperties.getProperty().equalsIgnoreCase("donationTip")) {
            lTipSettings.setDonationTip(getDonationTip(lProperties));
        }
    }

    mLog.debug("End loadTipSettings()");

    return lTipSettings;
}

From source file:net.douglasthrift.bigscreenbot.Settings.java

public boolean getBooleanProperty(String key, boolean defaultValue) {
    String value = getProperty(key);

    if (value != null)
        return Boolean.parseBoolean(value);
    else//from w ww  .  j a  va2 s.  co m
        return defaultValue;
}

From source file:com.clican.pluto.dataprocess.spring.parser.ForProcessorParser.java

@SuppressWarnings("unchecked")

public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) {
    this.setBeanDefinitionStringProperty("elementName", beanDef, element);
    this.setBeanDefinitionStringProperty("step", beanDef, element);
    this.setBeanDefinitionStringProperty("start", beanDef, element);
    this.setBeanDefinitionStringProperty("end", beanDef, element);
    String commit = element.getAttribute("stepCommit");
    if (StringUtils.isNotEmpty(commit)) {
        beanDef.getPropertyValues().addPropertyValue("stepCommit", Boolean.parseBoolean(commit));
    }//from   w ww.  j a  v  a2s  .  c o m
    String iteratorProcessors = element.getAttribute("iteratorProcessors");
    List iteratorProcessorList = new ManagedList();
    for (String nextDataProcess : iteratorProcessors.split(",")) {
        nextDataProcess = nextDataProcess.trim();
        iteratorProcessorList.add(new RuntimeBeanReference(nextDataProcess));
    }
    beanDef.getPropertyValues().addPropertyValue("iteratorProcessors", iteratorProcessorList);
}