spring-framework / org.springframework.expression.common / ExpressionUtils

ExpressionUtils

abstract class ExpressionUtils

Common utility functions that may be used by any Expression Language provider.

Author
Andy Clement

Author
Juergen Hoeller

Since
3.0

Constructors

<init>

ExpressionUtils()

Common utility functions that may be used by any Expression Language provider.

Functions

convertTypedValue

open static fun <T : Any> convertTypedValue(context: EvaluationContext, typedValue: TypedValue, targetType: Class<T>): T

Determines if there is a type converter available in the specified context and attempts to use it to convert the supplied value to the specified type. Throws an exception if conversion is not possible.

toBoolean

open static fun toBoolean(typeConverter: TypeConverter, typedValue: TypedValue): Boolean

Attempt to convert a typed value to a boolean using the supplied type converter.

toByte

open static fun toByte(typeConverter: TypeConverter, typedValue: TypedValue): Byte

Attempt to convert a typed value to a byte using the supplied type converter.

toChar

open static fun toChar(typeConverter: TypeConverter, typedValue: TypedValue): Char

Attempt to convert a typed value to a char using the supplied type converter.

toDouble

open static fun toDouble(typeConverter: TypeConverter, typedValue: TypedValue): Double

Attempt to convert a typed value to a double using the supplied type converter.

toFloat

open static fun toFloat(typeConverter: TypeConverter, typedValue: TypedValue): Float

Attempt to convert a typed value to a float using the supplied type converter.

toInt

open static fun toInt(typeConverter: TypeConverter, typedValue: TypedValue): Int

Attempt to convert a typed value to an int using the supplied type converter.

toLong

open static fun toLong(typeConverter: TypeConverter, typedValue: TypedValue): Long

Attempt to convert a typed value to a long using the supplied type converter.

toShort

open static fun toShort(typeConverter: TypeConverter, typedValue: TypedValue): Short

Attempt to convert a typed value to a short using the supplied type converter.