org.onemind.commons.java.util
Class ObjectUtils

java.lang.Object
  extended byorg.onemind.commons.java.util.ObjectUtils

public final class ObjectUtils
extends java.lang.Object

Property utilities

Version:
$Id: ObjectUtils.java,v 1.2 2004/08/26 12:33:17 thlee Exp $ $Name: $
Author:
TiongHiang Lee (thlee@onemindsoft.org)

Method Summary
static boolean toBool(java.lang.Object value, boolean def)
          Convert the object the boolean, return the default if it cannot be converted
static double toDouble(java.lang.Object value, double def)
          Convert the object to double, or return the default if it cannot be converted
static float toFloat(java.lang.Object value, float def)
          Convert the object to float, or return the default if it cannot be converted
static int toInt(java.lang.Object value, int def)
          Convert the object to int, or return the default if it cannot be converted
static long toLong(java.lang.Object value, long def)
          Convert the object to long, or return the default if it cannot be converted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toBool

public static final boolean toBool(java.lang.Object value,
                                   boolean def)
Convert the object the boolean, return the default if it cannot be converted

Parameters:
value - the value
def - the default
Returns:
the converted value, or def if value is null

toInt

public static int toInt(java.lang.Object value,
                        int def)
Convert the object to int, or return the default if it cannot be converted

Parameters:
value - the value
def - the default
Returns:
the converted int, or default if it cannot be converted

toLong

public static long toLong(java.lang.Object value,
                          long def)
Convert the object to long, or return the default if it cannot be converted

Parameters:
value - the value
def - the default
Returns:
the converted int, or default if it cannot be converted

toFloat

public static float toFloat(java.lang.Object value,
                            float def)
Convert the object to float, or return the default if it cannot be converted

Parameters:
value - the value
def - the default
Returns:
the converted int, or default if it cannot be converted

toDouble

public static double toDouble(java.lang.Object value,
                              double def)
Convert the object to double, or return the default if it cannot be converted

Parameters:
value - the value
def - the default
Returns:
the converted int, or default if it cannot be converted


Copyright © 2004-2006 . All Rights Reserved.