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.google.web.bindery.autobean.vm.impl.JsonSplittable.java

public static Splittable create(String payload) {
    try {//from   w ww .j  ava  2 s  .  c  o m
        switch (payload.charAt(0)) {
        case '{':
            return new JsonSplittable(new JSONObject(payload));
        case '[':
            return new JsonSplittable(new JSONArray(payload));
        case '"':
            return new JsonSplittable(new JSONArray("[" + payload + "]").getString(0));
        case '-':
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':
            return new JsonSplittable(Double.parseDouble(payload));
        case 't':
        case 'f':
            return new JsonSplittable(Boolean.parseBoolean(payload));
        case 'n':
            return null;
        default:
            throw new RuntimeException("Could not parse payload: payload[0] = " + payload.charAt(0));
        }
    } catch (JSONException e) {
        throw new RuntimeException("Could not parse payload", e);
    }
}

From source file:com.connectsdk.device.netcast.NetcastVolumeParser.java

@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
    try {/*www . j  a v  a 2  s .c om*/
        if (qName.equalsIgnoreCase(MUTE)) {
            volumeStatus.put(MUTE, Boolean.parseBoolean(value));
        } else if (qName.equalsIgnoreCase(MIN_LEVEL)) {
            volumeStatus.put(MIN_LEVEL, Integer.parseInt(value));
        } else if (qName.equalsIgnoreCase(MAX_LEVEL)) {
            volumeStatus.put(MAX_LEVEL, Integer.parseInt(value));
        } else if (qName.equalsIgnoreCase(LEVEL)) {
            volumeStatus.put(LEVEL, Integer.parseInt(value));
        }
        value = null;
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.cloudbees.workflow.rest.external.ChangeSetExt.java

/** Allows user to disable Jenkins user lookup for commit authors
 * By setting System Property com.cloudbees.workflow.rest.external.ChangeSetExt.resolveCommitAuthors to 'false'
 * This is a workaround for JENKINS-35484 where user lookup encounters issues */
private static boolean resolveCommitAuthors() {
    String prop = System.getProperty(ChangeSetExt.class.getName() + ".resolveCommitAuthors");
    return (StringUtils.isEmpty(prop) || Boolean.parseBoolean(prop));
}

From source file:com.haulmont.cuba.gui.xml.DeclarativeAction.java

public DeclarativeAction(String id, String caption, String description, String icon, String enable,
        String visible, String methodName, @Nullable String shortcut, Component.ActionsHolder holder) {
    super(id, shortcut);
    this.caption = caption;
    this.description = description;
    this.icon = icon;

    setEnabled(enable == null || Boolean.parseBoolean(enable));
    setVisible(visible == null || Boolean.parseBoolean(visible));

    this.methodName = methodName;
    checkActionsHolder(holder);//  w  ww.  ja  v a2  s.c om
}

From source file:ar.com.zauber.commons.spring.beans.factory.impl.BooleanSystemPropertyCaseBlock.java

/** @see CaseBlock#evaluate() */
public final boolean evaluate() {
    return Boolean.parseBoolean(System.getProperty(propertyName, "false"));
}

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

protected void loadTrimming(TextInputField.TrimSupported component, Element element) {
    String trim = element.attributeValue("trim");
    if (StringUtils.isNotEmpty(trim)) {
        component.setTrimming(Boolean.parseBoolean(trim));
    }/*from  w w  w  .  j  a v  a 2s  .co m*/
}

From source file:com.omertron.omdbapi.model.AbstractJsonMapping.java

@JsonProperty("Response")
public void setResponse(String response) {
    this.response = Boolean.parseBoolean(response);
}

From source file:com.evolveum.midpoint.web.security.LocaleDescriptor.java

public LocaleDescriptor(String name, String flag, String def, Locale locale) {
    this.flag = flag;
    this.locale = locale;
    this.name = name;
    this.def = Boolean.parseBoolean(def);
}

From source file:com.clustercontrol.winsyslog.WinSyslogConfig.java

public static boolean getBooleanProperty(String key, boolean defaultValue) {
    log.debug(key + " = " + properties.getProperty(key));
    return Boolean.parseBoolean(properties.getProperty(key, String.valueOf(defaultValue)));
}

From source file:com.athena.meerkat.controller.web.provisioning.util.ProvisioningUtil.java

protected static boolean runCmds(File commanderDir, List<String> cmds) {
    String isSuccess = CommandUtil.execWithLog(commanderDir, cmds);

    return Boolean.parseBoolean(isSuccess);
}