类 ExpressionUtils
java.lang.Object
cn.taketoday.expression.common.ExpressionUtils
Common utility functions that may be used by any Expression Language provider.
- 从以下版本开始:
- 4.0
- 作者:
- Andy Clement, Juergen Hoeller
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static <T> TconvertTypedValue(EvaluationContext context, TypedValue typedValue, Class<T> targetType) 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.private static <T> TconvertValue(TypeConverter typeConverter, TypedValue typedValue, Class<T> targetType) static booleantoBoolean(TypeConverter typeConverter, TypedValue typedValue) Attempt to convert a typed value to a boolean using the supplied type converter.static bytetoByte(TypeConverter typeConverter, TypedValue typedValue) Attempt to convert a typed value to a byte using the supplied type converter.static chartoChar(TypeConverter typeConverter, TypedValue typedValue) Attempt to convert a typed value to a char using the supplied type converter.static doubletoDouble(TypeConverter typeConverter, TypedValue typedValue) Attempt to convert a typed value to a double using the supplied type converter.static floattoFloat(TypeConverter typeConverter, TypedValue typedValue) Attempt to convert a typed value to a float using the supplied type converter.static inttoInt(TypeConverter typeConverter, TypedValue typedValue) Attempt to convert a typed value to an int using the supplied type converter.static longtoLong(TypeConverter typeConverter, TypedValue typedValue) Attempt to convert a typed value to a long using the supplied type converter.static shorttoShort(TypeConverter typeConverter, TypedValue typedValue) Attempt to convert a typed value to a short using the supplied type converter.
-
构造器详细资料
-
ExpressionUtils
public ExpressionUtils()
-
-
方法详细资料
-
convertTypedValue
@Nullable public static <T> T convertTypedValue(@Nullable EvaluationContext context, TypedValue typedValue, @Nullable Class<T> targetType) 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.- 参数:
context- the evaluation context that may define a type convertertypedValue- the value to convert and a type descriptor describing ittargetType- the type to attempt conversion to- 返回:
- the converted value
- 抛出:
EvaluationException- if there is a problem during conversion or conversion of the value to the specified type is not supported
-
toInt
Attempt to convert a typed value to an int using the supplied type converter. -
toBoolean
Attempt to convert a typed value to a boolean using the supplied type converter. -
toDouble
Attempt to convert a typed value to a double using the supplied type converter. -
toLong
Attempt to convert a typed value to a long using the supplied type converter. -
toChar
Attempt to convert a typed value to a char using the supplied type converter. -
toShort
Attempt to convert a typed value to a short using the supplied type converter. -
toFloat
Attempt to convert a typed value to a float using the supplied type converter. -
toByte
Attempt to convert a typed value to a byte using the supplied type converter. -
convertValue
private static <T> T convertValue(TypeConverter typeConverter, TypedValue typedValue, Class<T> targetType)
-