else if (pValue instanceof Boolean) {
if (log.isErrorEnabled()) {
String message = _MessageUtil.getMessageWithArgs(
_Constants.BOOLEAN_TO_NUMBER, pValue, pClass.getName());
log.error(message);
throw new ELException(message);
}
return coerceToPrimitiveNumber(ZERO, pClass);
}
else if (pValue.getClass () == pClass) {
return (Number) pValue;
}
else if (pValue instanceof Number) {
return coerceToPrimitiveNumber ((Number) pValue, pClass);
}
else if (pValue instanceof String) {
try {
return coerceToPrimitiveNumber ((String) pValue, pClass);
}
catch (Exception exc) {
if (log.isErrorEnabled()) {
String message = _MessageUtil.getMessageWithArgs(
_Constants.STRING_TO_NUMBER_EXCEPTION,
(String) pValue, pClass.getName());
log.error(message);
throw new ELException(message);
}
return coerceToPrimitiveNumber (ZERO, pClass);
}
}
else {
if (log.isErrorEnabled()) {
String message = _MessageUtil.getMessageWithArgs(
_Constants.COERCE_TO_NUMBER,
pValue.getClass().getName(),
pClass.getName());
log.error(message);
throw new ELException(message);
}
return coerceToPrimitiveNumber (0, pClass);
}
}