Here you can find the source of asBoolean(Object value)
public static boolean asBoolean(Object value)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean asBoolean(Object value) { if (value == null) throw new NullPointerException("value is null"); if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); }//ww w . j a v a 2 s . c o m throw new IllegalArgumentException("not a boolean"); } public static boolean asBoolean(Object value, boolean def) { if (value == null) return def; if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); } throw new IllegalArgumentException("not a boolean"); } }