Here you can find the source of toBoolean(Object o)
public static Boolean toBoolean(Object o)
//package com.java2s; /* SpagoBI, the Open Source Business Intelligence suite /*from ww w . ja va 2 s . c om*/ * Copyright (C) 2012 Engineering Ingegneria Informatica S.p.A. - SpagoBI Competency Center * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, without the "Incompatible With Secondary Licenses" notice. * If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ public class Main { public static Boolean toBoolean(Object o) { Boolean toReturn; assertNotNull(o, "Input object cannot be null"); if (o instanceof Boolean) { toReturn = (Boolean) o; } else { toReturn = new Boolean(toString(o)); } return toReturn; } private static void assertNotNull(Object o, String message) { if (o == null) { throw new IllegalArgumentException(message); } } public static String toString(Object o) { String toReturn; assertNotNull(o, "Input object cannot be null"); toReturn = o.toString(); return toReturn; } }