Here you can find the source of booleanValue(Object associationValue)
public static boolean booleanValue(Object associationValue)
//package com.java2s; /*// w w w . j av a 2s . c o m * _WOJExtensionsUtil.java * (c) Copyright 2001 Apple Computer, Inc. All rights reserved. * This a modified version. * Original license: http://www.opensource.apple.com/apsl/ */ public class Main { public static boolean booleanValue(Object associationValue) { boolean associationEvaluation = true; if (associationValue != null) { // is this a number. If it is, evaluate it. if (associationValue instanceof Number) { if (((Number) associationValue).intValue() == 0) { associationEvaluation = false; } } else if (associationValue instanceof String) { String associationValueString = (String) associationValue; // is this no or false ? if (associationValueString.equalsIgnoreCase("no") || associationValueString.equalsIgnoreCase("false")) { associationEvaluation = false; } else { // is this a string representing a number ? Try to evaluate it. try { if (Integer.parseInt(associationValueString) == 0) { associationEvaluation = false; } } catch (NumberFormatException e) { throw new RuntimeException( "error parsing boolean from value " + associationValueString); } } } else if (associationValue instanceof Boolean) { associationEvaluation = ((Boolean) associationValue) .booleanValue(); } else { // do nothing, it's non-null, so it's true ! } } else { associationEvaluation = false; } return associationEvaluation; } }