Here you can find the source of toBoolean(Object object)
Parameter | Description |
---|---|
object | the object |
public static boolean toBoolean(Object object)
//package com.java2s; /*/* www .j ava 2s . co m*/ Mini Focused Crawler : focused web crawler with a simple GUI Copyright (C) 2013 lbertelo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Converts an object to a boolean (return false if the conversion fail) * @param object the object * @return the boolean */ public static boolean toBoolean(Object object) { if (object instanceof Boolean) { return ((Boolean) object).booleanValue(); } else if (object instanceof String) { return Boolean.parseBoolean((String) object); } else { return false; } } }