public static char toCharValue(Object o, char defaultValue) {
	if (o instanceof Character) return ((Character) o).charValue();
	else if (o instanceof Boolean) return (char) ((((Boolean) o).booleanValue()) ? 1 : 0);
	else if (o instanceof Double) return (char) (((Double) o).doubleValue());
	else if (o instanceof Number) return (char) (((Number) o).doubleValue());
	else if (o instanceof String) {
	    String str = o.toString();
	    if (str.length() > 0) return str.charAt(0);
	    return defaultValue;

	}
	else if (o instanceof ObjectWrap) {
	    return toCharValue(((ObjectWrap) o).getEmbededObject(toCharacter(defaultValue)), defaultValue);
	}
	else if (o == null) return toCharValue("", defaultValue);
	return defaultValue;
    }
public static char toCharValue ( Object o , char defaultValue ) { if ( o instanceof Character ) return ( ( Character ) o ) . charValue ( ) ; else if ( o instanceof Boolean ) return ( char ) ( ( ( ( Boolean ) o ) . booleanValue ( ) ) ? 1 : 0 ) ; else if ( o instanceof Double ) return ( char ) ( ( ( Double ) o ) . doubleValue ( ) ) ; else if ( o instanceof Number ) return ( char ) ( ( ( Number ) o ) . doubleValue ( ) ) ; else if ( o instanceof String ) { String str = o . toString ( ) ; if ( str . length ( ) > 0 ) return str . charAt ( 0 ) ; return defaultValue ; } else if ( o instanceof ObjectWrap ) { return toCharValue ( ( ( ObjectWrap ) o ) . getEmbededObject ( toCharacter ( defaultValue ) ) , defaultValue ) ; } else if ( o == null ) return toCharValue ( "" , defaultValue ) ; return defaultValue ; }
cast a Object to a char value (primitive value type)

@param o Object to cast
@param defaultValue
@return casted char value