Here you can find the source of castBoolean(Object o)
public static Boolean castBoolean(Object o)
//package com.java2s; //License from project: Open Source License public class Main { public static Boolean castBoolean(Object o) { if (o instanceof Boolean) { return (Boolean) o; } else if (o instanceof String) { try { return Boolean.parseBoolean((String) o); } catch (IllegalArgumentException e) { return null; }/* www .j av a 2s . c o m*/ } return null; } }