Here you can find the source of tryParseBool(Object obj, Boolean defaultVal)
public static Boolean tryParseBool(Object obj, Boolean defaultVal)
//package com.java2s; //License from project: Apache License public class Main { public static Boolean tryParseBool(Object obj, Boolean defaultVal) { if (obj == null) return defaultVal; if (obj instanceof Boolean) return (Boolean) obj; try {// w w w.j a v a 2 s . co m String val = obj.toString(); return Boolean.parseBoolean(val); } catch (Exception e) { return defaultVal; } } }