List of usage examples for java.lang Boolean valueOf
public static Boolean valueOf(String s)
From source file:Main.java
public static boolean isInDaylightSavings() { return Boolean.valueOf(TimeZone.getDefault().inDaylightTime(new Date())); }
From source file:Main.java
public static Boolean booleanIsNull(String s) { if (null == s || "".equals(s)) { return false; } else {// w w w . j ava 2 s . c o m return Boolean.valueOf(s); } }
From source file:Main.java
public static Boolean getBoolean(String key) { return Boolean.valueOf(sp.getBoolean(key, false)); }
From source file:Main.java
protected static boolean mGetBooleanValueOf(String pVal, boolean pDefault) { if (pVal == null || pVal.isEmpty()) return pDefault; return Boolean.valueOf(pVal); }
From source file:Main.java
/** * box the boolean to Boolean */ public static Boolean boxed(boolean v) { return Boolean.valueOf(v); }
From source file:Main.java
/** * Convert String value to Boolean//ww w .j a v a 2s .co m * * @param val * @return boolean */ public static boolean ParseBoolean(String val) { try { boolean bl = Boolean.valueOf(val); return bl; } catch (Exception e) { return false; } }
From source file:Main.java
public static Object getObject(String type, String value) throws Exception { type = type.toLowerCase();/*from w ww . j a v a 2 s.c o m*/ if ("boolean".equals(type)) return Boolean.valueOf(value); if ("byte".equals(type)) return Byte.valueOf(value); if ("short".equals(type)) return Short.valueOf(value); if ("char".equals(type)) if (value.length() != 1) throw new NumberFormatException("Argument is not a character!"); else return Character.valueOf(value.toCharArray()[0]); if ("int".equals(type)) return Integer.valueOf(value); if ("long".equals(type)) return Long.valueOf(value); if ("float".equals(type)) return Float.valueOf(value); if ("double".equals(type)) return Double.valueOf(value); if ("string".equals(type)) return value; else { Object objs[] = new String[] { value }; return Class.forName(type).getConstructor(new Class[] { java.lang.String.class }).newInstance(objs); } }
From source file:Main.java
public static boolean parseBool(String bool, boolean def) { if (bool == null || bool.equals("")) { return def; } else {//ww w . j a v a 2 s. c om return Boolean.valueOf(bool); } //else //else // throw new SAXException("Expected a boolean, got'"+bool+"'"); }
From source file:Main.java
public static void writeBoolean(ByteArrayOutputStream baos, Object o) { if (o instanceof Boolean) { writeBoolean(baos, Boolean.valueOf((Boolean) o)); } else {//ww w. java 2 s . com writeBoolean(baos, Boolean.valueOf(o.toString())); } }
From source file:Main.java
public static Boolean getBoolean(String key, boolean defVal) { return Boolean.valueOf(sp.getBoolean(key, defVal)); }