Example usage for java.lang Boolean valueOf

List of usage examples for java.lang Boolean valueOf

Introduction

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

Prototype

public static Boolean valueOf(String s) 

Source Link

Document

Returns a Boolean with a value represented by the specified string.

Usage

From source file:org.intalio.tempo.uiframework.actions.TasksAction.java

@Override
public ModelAndView execute() {
    if (Boolean.valueOf(_request.getParameter("update")).booleanValue()) {
        return new ModelAndView(Constants.TASKS_UPDATE_VIEW, createModel());
    } else {//ww w. j  av a  2 s.c  o  m
        return new ModelAndView(Constants.TASKS_VIEW, createModel());
    }
}

From source file:Main.java

/**
 * Converts to object array./*from w w  w.  j a va2  s .  com*/
 */
public static Boolean[] valuesOf(boolean[] array) {
    Boolean[] dest = new Boolean[array.length];
    for (int i = 0; i < array.length; i++) {
        dest[i] = Boolean.valueOf(array[i]);
    }
    return dest;
}

From source file:Main.java

/**
 * Read a boolean[] object from an XmlPullParser.  The XML data could
 * previously have been generated by writeBooleanArrayXml().  The XmlPullParser
 * must be positioned <em>after</em> the tag that begins the list.
 *
 * @param parser The XmlPullParser from which to read the list data.
 * @param endTag Name of the tag that will end the list, usually "string-array".
 * @param name   An array of one string, used to return the name attribute
 *               of the list's tag.//  w w w  .j a v a2  s.  c  o m
 * @return Returns a newly generated boolean[].
 * @see #readListXml
 */
public static final boolean[] readThisBooleanArrayXml(XmlPullParser parser, String endTag, String[] name)
        throws XmlPullParserException, IOException {

    int num;
    try {
        num = Integer.parseInt(parser.getAttributeValue(null, "num"));
    } catch (NullPointerException e) {
        throw new XmlPullParserException("Need num attribute in string-array");
    } catch (NumberFormatException e) {
        throw new XmlPullParserException("Not a number in num attribute in string-array");
    }
    parser.next();

    boolean[] array = new boolean[num];
    int i = 0;

    int eventType = parser.getEventType();
    do {
        if (eventType == parser.START_TAG) {
            if (parser.getName().equals("item")) {
                try {
                    array[i] = Boolean.valueOf(parser.getAttributeValue(null, "value"));
                } catch (NullPointerException e) {
                    throw new XmlPullParserException("Need value attribute in item");
                } catch (NumberFormatException e) {
                    throw new XmlPullParserException("Not a number in value attribute in item");
                }
            } else {
                throw new XmlPullParserException("Expected item tag at: " + parser.getName());
            }
        } else if (eventType == parser.END_TAG) {
            if (parser.getName().equals(endTag)) {
                return array;
            } else if (parser.getName().equals("item")) {
                i++;
            } else {
                throw new XmlPullParserException("Expected " + endTag + " end tag at: " + parser.getName());
            }
        }
        eventType = parser.next();
    } while (eventType != parser.END_DOCUMENT);

    throw new XmlPullParserException("Document ended before " + endTag + " end tag");
}

From source file:com.jnj.b2b.core.search.solrfacetsearch.provider.impl.MultidimentionalProductFlagValueProvider.java

@Override
public Object getFieldValue(final ProductModel product) {
    Boolean isMultidimentional = null;

    final Object variants = modelService.getAttributeValue(product, "variants");
    isMultidimentional = Boolean.valueOf(CollectionUtils.isNotEmpty((Collection) variants));

    return isMultidimentional;
}

From source file:com.watchrabbit.crawler.driver.util.AngularLoadingStrategy.java

@Override
public boolean shouldWait(RemoteWebDriver driver) {
    return Boolean
            .valueOf(((JavascriptExecutor) driver).executeScript("return (window.angular != null)").toString());
}

From source file:eu.openanalytics.shinyproxy.ShinyProxyConfiguration.java

@PostConstruct
public void init() {
    // Enable heartbeat unless explicitly disabled.
    boolean enabled = Boolean.valueOf(environment.getProperty("proxy.heartbeat-enabled", "true"));
    heartbeatService.setEnabled(enabled);
}

From source file:architecture.common.lifecycle.internal.AbstractApplicationProperties.java

public boolean getBooleanProperty(String propertyKey, boolean defaultValue) {
    String value = get(propertyKey);
    if (value != null)
        return Boolean.valueOf(value).booleanValue();
    else//from   ww  w .  jav a2s .  c om
        return defaultValue;
}

From source file:org.atomserver.spring.WorkspaceBeanDefinitionParser.java

protected void doParse(Element element, BeanDefinitionBuilder bean) {
    bean.addPropertyValue("name", element.getAttribute("name"));
    bean.addPropertyValue("defaultLocalized", Boolean.valueOf(element.getAttribute("localized")));
}

From source file:com.acc.storefront.interceptors.beforeview.ConfigGranuleBeforeViewHandler.java

@Override
public void beforeView(final HttpServletRequest request, final HttpServletResponse response,
        final ModelAndView modelAndView) throws Exception {
    modelAndView.addObject("granuleEnabled",
            Boolean.valueOf(getSiteConfigService().getBoolean("storefront.granule.enabled", false)));
}

From source file:org.nabucco.alfresco.enhScriptEnv.common.webscripts.RemoteJavascriptDebuggerGet.java

/**
 *
 * {@inheritDoc}//w  ww .ja v  a  2  s  .c o  m
 */
@Override
protected Map<String, Object> executeImpl(final WebScriptRequest req, final Status status) {
    // construct model
    final Map<String, Object> model = new HashMap<String, Object>(7, 1.0f);
    model.put("visible", Boolean.valueOf(this.debugger.isActive()));
    return model;
}