List of usage examples for java.lang Boolean parseBoolean
public static boolean parseBoolean(String s)
From source file:Main.java
/** * Devuelve un boolean desde un string // w w w. j a va 2s . c o m * * @author Toni * @ * @param String a convertir a boolean * @return un boolean o false si no se ha podido convertir * @see utilidades */ public static boolean queBoolean(String s) { try { return Boolean.parseBoolean(s); } catch (NumberFormatException e) { return false; } }
From source file:Main.java
public static boolean read_setting_boolean(String key, boolean default_value) { try {//ww w. java 2s . c om return global_setting.getBoolean(key, default_value); } catch (ClassCastException e) { return Boolean.parseBoolean(global_setting.getString(key, Boolean.toString(default_value))); } }
From source file:Main.java
public static boolean getAttributeBooleanValue(Node n, String item, boolean dflt) { final Node d = n.getAttributes().getNamedItem(item); if (d == null) return dflt; final String val = d.getNodeValue(); if (val == null) return dflt; return Boolean.parseBoolean(val); }
From source file:Main.java
public static boolean getBooleanProperty(Properties properties, String key, boolean defaultValue) { if (properties != null) { String value = properties.getProperty(key, "").trim().toLowerCase(); if (!value.equals("")) { return Boolean.parseBoolean(value); }//from ww w . j ava 2 s. com } return defaultValue; }
From source file:Main.java
/** * Parse string value as boolean. Return default value if source * string is null./*from w w w.ja v a 2 s. c o m*/ * @param value String * @param defValue boolean * @return boolean */ public static boolean getAsBoolean(String value, boolean defValue) { boolean result = defValue; if (value != null) { result = Boolean.parseBoolean(value); } return result; }
From source file:Main.java
public static boolean getAttributeBooleanValue(Node n, String item, boolean dflt) { final Node d = n.getAttributes().getNamedItem(item); if (d == null) { return dflt; }// www. j a v a2 s . co m final String val = d.getNodeValue(); if (val == null) { return dflt; } return Boolean.parseBoolean(val); }
From source file:Main.java
public static boolean getBooleanValue(Object o, boolean defaultVal) { if (o == null) return Boolean.valueOf(defaultVal); if (o.toString().trim().length() == 0) return Boolean.valueOf(defaultVal); if (o instanceof Boolean) return (Boolean) o; if (o instanceof String) return Boolean.parseBoolean((String) o); return Boolean.valueOf(defaultVal); }
From source file:Main.java
public static boolean attributeBooleanGet(Element e, String name, boolean defaultValue) { if (!e.hasAttribute(name)) { return defaultValue; } else {//from w w w . java 2 s . co m return Boolean.parseBoolean(e.getAttribute(name)); } }
From source file:Main.java
public static boolean getBoolAttribute(Node node, String name, boolean defVal) { String att = getAttribute(node, name); if (att == null) return defVal; return Boolean.parseBoolean(att); }
From source file:Main.java
public static boolean getBooleanProperty(Element properties, String name) { return Boolean.parseBoolean( getPropertyNode(properties, name).getAttributes().getNamedItem(BOOLEAN_ATTR).getNodeValue()); }