001 /***************************************************************************** 002 * Copyright (C) PicoContainer Organization. All rights reserved. * 003 * ------------------------------------------------------------------------- * 004 * The software in this package is published under the terms of the BSD * 005 * style license a copy of which has been included with this distribution in * 006 * the LICENSE.txt file. * 007 * * 008 * Original code by * 009 *****************************************************************************/ 010 package org.picocontainer.script.xml; 011 012 public class AttributeUtils { 013 014 public static final String EMPTY = ""; 015 016 017 public static boolean notSet(Object string) { 018 return string == null || string.equals(EMPTY); 019 } 020 021 public static boolean isSet(Object string) { 022 return !notSet(string); 023 } 024 025 public static boolean boolValue(String string, boolean defaultValue) { 026 if (notSet(string)) { 027 return defaultValue; 028 } 029 boolean aBoolean = Boolean.valueOf(string).booleanValue(); 030 return aBoolean; 031 } 032 }