Example usage for java.lang Boolean toString

List of usage examples for java.lang Boolean toString

Introduction

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

Prototype

public static String toString(boolean b) 

Source Link

Document

Returns a String object representing the specified boolean.

Usage

From source file:com.ltasks.BaseClient.java

/**
 * Post the data to the remote resource.
 * //from   w w  w . ja  v a 2s  .c o  m
 * @param data
 *            the data to post
 * @return the returned object
 * @throws HttpException
 *             Got a protocol error.
 * @throws IOException
 *             Failed to communicate or to read the result.
 * @throws IllegalArgumentException
 *             The data received from server was invalid.
 */
protected LtasksObject post(List<NameValuePair> data)
        throws HttpException, IOException, IllegalArgumentException {
    GZipPostMethod method = new GZipPostMethod(getResourceUrl(), mIsGZipContentEncoding);

    // Set input content type
    method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");

    // Set response/output format
    method.setRequestHeader("Accept", "application/xml");

    method.setRequestHeader("Accept-Charset", "utf-8");

    List<NameValuePair> body = new ArrayList<NameValuePair>(data.size() + 2);
    body.addAll(data);
    body.add(new NameValuePair("apikey", mApiKey));
    body.add(new NameValuePair("includeSourceText", Boolean.toString(mIsIncludeSource)));

    method.setRequestBody(body.toArray(new NameValuePair[body.size()]));
    method.setContentChunked(true);

    if (mIsGZipContentEncoding) {
        method.setRequestHeader("Accept-Encoding", "gzip");
        method.setRequestHeader("Content-Encoding", "gzip");
    }

    boolean processedOk = false;
    int code = client.executeMethod(method);
    if (code == 200) {
        processedOk = true;
    }
    InputStream is;
    if (method.getResponseHeader("Content-Encoding") != null
            && method.getResponseHeader("Content-Encoding").getValue().contains("gzip")) {
        is = new GZIPInputStream(method.getResponseBodyAsStream());
    } else {
        is = method.getResponseBodyAsStream();
    }

    LtasksObject result = null;
    if (is != null) {
        try {
            result = ResultParser.parse(is, processedOk);
        } catch (ParserConfigurationException e) {
            throw new IllegalArgumentException("Got an invalid response from server.", e);
        } catch (SAXException e) {
            throw new IllegalArgumentException("Got an invalid response from server.", e);
        }
    } else {
        result = new LtasksObject(null, "Failed to process request. Code: " + code, false, null);
    }
    is.close();
    method.releaseConnection();
    return result;
}

From source file:io.pcp.parfait.benchmark.CPUThreadTest.java

private String leftPadBoolean(boolean theBoolean) {
    return StringUtils.leftPad(Boolean.toString(theBoolean), 5);
}

From source file:ml.shifu.shifu.core.binning.CategoricalBinning.java

public String objToString() {
    return super.objToString() + Character.toString(FIELD_SEPARATOR) + Boolean.toString(isValid)
            + Character.toString(FIELD_SEPARATOR) + StringUtils.join(categoricalVals, SETLIST_SEPARATOR);
}

From source file:smarthome.FXMLDocumentController.java

@FXML
private void settingButtonAction(ActionEvent event) {

    setPreference(ipTF.getText(), videoTF.getText(), Boolean.toString(startupVoice.isSelected()));
    getPreference();/*from w w  w  . j  a  v  a2 s.  c  o m*/
    updateTextField();
    System.out.println("Current Value :" + ipaddress);
    System.out.println(startupVoice.isSelected());
    //update the webviews with the new values
    final WebEngine eng1 = webview2.getEngine();
    eng1.load("http://" + ipaddress + ":8000");
    //eng1.reload();

    final WebEngine eng2 = webview1.getEngine();
    eng2.load("http://" + ipaddress + ":8000/room1.html");
    //eng1.reload();
    final WebEngine eng3 = ipCamView.getEngine();
    eng3.load(videoLink);
    //eng3.reload();
    ///////////////////////////////////////////

}

From source file:blue.soundObject.jmask.Parameter.java

public Element saveAsXML() {
    Element retVal = new Element("parameter");
    retVal.setAttribute("visible", Boolean.toString(visible));
    retVal.setAttribute("name", getName());

    retVal.addElement(generator.saveAsXML());

    if (mask != null) {
        retVal.addElement(mask.saveAsXML());
    }//from   w  w  w. j ava 2s. c  om

    if (quantizer != null) {
        retVal.addElement(quantizer.saveAsXML());
    }

    if (accumulator != null) {
        retVal.addElement(accumulator.saveAsXML());
    }

    return retVal;
}

From source file:com.microsoft.alm.plugin.idea.common.ui.common.tabs.TabModelImpl.java

public void setAutoRefresh(final boolean autoRefresh) {
    if (this.autoRefresh != autoRefresh) {
        this.autoRefresh = autoRefresh;
        setChangedAndNotify(PROP_AUTO_REFRESH);
        PropertyServiceImpl.getInstance().setProperty(propertyStoragePrefix + PROP_AUTO_REFRESH,
                Boolean.toString(autoRefresh));
    }/*from www.jav  a  2s  . c  o  m*/
}

From source file:org.alfresco.util.exec.RuntimeExecBootstrapBean.java

/**
 * Set whether or not the process should be disabled at ApplicationContext bootstrap.
 * If a RuntimeExecBootstrapBean is disabled, then the command will not be executed.
 * This property is not required and is <code>false</code> by default.
 * <P/>//w w w .j  a  v  a 2s. c o m
 * This method has been deprecated in favour of a clearer name introduced in 3.3.
 * See {@link #setEnabled}.
 * 
 * @param disabledAtStartUp any String which <code>equalsIgnoreCase("true")</code>
 *        to prevent the command from being executed.
 * @since 3.2.1
 * @deprecated Use {@link #setEnabled} instead, remembering that the boolean property should be inverted.
 */
public void setDisabledAtStartUp(String disabledAtStartUp) {
    boolean disabled = Boolean.parseBoolean(disabledAtStartUp);
    this.setEnabled(Boolean.toString(!disabled));
}

From source file:blue.orchestra.blueSynthBuilder.BSBGraphicInterface.java

/**
 * @return//from w ww.ja  v  a2s .  co m
 */
public Element saveAsXML() {
    Element retVal = new Element("graphicInterface");

    retVal.setAttribute("editEnabled", Boolean.toString(editEnabled));

    retVal.addElement(gridSettings.saveAsXML());

    for (Iterator<BSBObject> iter = interfaceItems.iterator(); iter.hasNext();) {
        BSBObject bsbObj = iter.next();
        retVal.addElement(bsbObj.saveAsXML());
    }

    return retVal;
}