org.apache.commons.jexl.util

## Class Coercion

- java.lang.Object
- - org.apache.commons.jexl.util.Coercion

    public class Coercion
    extends java.lang.Object

Coercion utilities for the JSTL EL-like coercion.

Since:
  1.0
Author:
  Geir Magnusson Jr.

### Constructor Summary

Constructors
Constructor and Description
`Coercion()`

### Method Summary

Methods
`static java.lang.Boolean` `coerceBoolean(java.lang.Object val)` Coerce to a Boolean.
`static java.lang.Double` `coerceDouble(java.lang.Object val)` Coerce to a Double.
`static java.lang.Integer` `coerceInteger(java.lang.Object val)` Coerce to a Integer.
`static java.lang.Long` `coerceLong(java.lang.Object val)` Coerce to a Long.
`static boolean` `isFloatingPoint(java.lang.Object o)` Is Object a floating point number.
`static boolean` `isNumberable(java.lang.Object o)` Is Object a whole number.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Coercion

    public Coercion()

### Method Detail

#### coerceBoolean

    public static java.lang.Boolean coerceBoolean(java.lang.Object val)

Coerce to a Boolean.

Parameters:
  `val` - Object to be coerced.
Returns:
  The Boolean coerced value, or null if none possible.

#### coerceInteger

    public static java.lang.Integer coerceInteger(java.lang.Object val)
                                           throws java.lang.Exception

Coerce to a Integer.

Parameters:
  `val` - Object to be coerced.
Returns:
  The Integer coerced value.
Throws:
  `java.lang.Exception` - If Integer coercion fails.

#### coerceLong

    public static java.lang.Long coerceLong(java.lang.Object val)
                                     throws java.lang.Exception

Coerce to a Long.

Parameters:
  `val` - Object to be coerced.
Returns:
  The Long coerced value.
Throws:
  `java.lang.Exception` - If Long coercion fails.

#### coerceDouble

    public static java.lang.Double coerceDouble(java.lang.Object val)
                                         throws java.lang.Exception

Coerce to a Double.

Parameters:
  `val` - Object to be coerced.
Returns:
  The Double coerced value.
Throws:
  `java.lang.Exception` - If Double coercion fails.

#### isFloatingPoint

    public static boolean isFloatingPoint(java.lang.Object o)

Is Object a floating point number.

Parameters:
  `o` - Object to be analyzed.
Returns:
  true if it is a Float or a Double.

#### isNumberable

    public static boolean isNumberable(java.lang.Object o)

Is Object a whole number.

Parameters:
  `o` - Object to be analyzed.
Returns:
  true if Integer, Long, Byte, Short or Character.