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:Main.java

public static boolean getBooleanAttribute(Element el, String attr) {
    return Boolean.parseBoolean(el.getAttribute(attr));
}

From source file:Main.java

public static boolean doBoolean(Object obj) {
    return obj != null ? Boolean.parseBoolean(obj.toString()) : false;
}

From source file:Main.java

private static boolean stringAsBool(String str, boolean defaultValue) {
    return str != null && str.length() > 0 ? Boolean.parseBoolean(str) : defaultValue;
}

From source file:Main.java

public static boolean toBool(String b) {
    try {/*  ww  w  .  j a  v  a2 s  .co  m*/
        return Boolean.parseBoolean(b);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}

From source file:Main.java

public static boolean getBoolean(String string, boolean fallback) {
    boolean b;//from www .j a  v  a2s.c o m
    try {
        b = Boolean.parseBoolean(string);
    } catch (Exception e) {
        b = fallback;
    }
    return b;
}

From source file:Main.java

public static boolean getBoolAttribute(Node node, String name) {
    return Boolean.parseBoolean(getAttribute(node, name));
}

From source file:Main.java

public static boolean parseBoolean(String value) {
    boolean boolValue = false;
    try {/*  w  w  w  . j av a  2s .co  m*/
        boolValue = Boolean.parseBoolean(value.toLowerCase());
    } catch (Exception e) {
    }
    return boolValue;
}

From source file:Main.java

public static Boolean stringToBoolean(String str) {
    Boolean rst = null;//from  www.  j  a v  a 2  s.  c  om
    try {
        rst = Boolean.parseBoolean(str);
    } catch (Exception e) {
        // do nothing
    }
    return rst;
}

From source file:Main.java

public static boolean toBoolean(Object srcStr, boolean defaultValue) {
    try {//from   w w  w . ja v a  2  s.  com
        if (srcStr != null) {
            return Boolean.parseBoolean(trim1(srcStr.toString()));
        }
    } catch (Exception e) {
        ;
    }
    return defaultValue;
}

From source file:Main.java

public static boolean tryParseBoolean(String text, boolean def) {
    boolean ret = false;
    try {//from w w w. jav a  2  s.co m
        ret = Boolean.parseBoolean(text);
    } catch (Exception e) {
        ret = def;
    }

    return ret;
}