public class LogSpelUtil extends Object
| 构造器和说明 |
|---|
LogSpelUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static LogSpelEvaluationContext |
buildSpelContext(Object target,
Method method,
Object[] args)
构建 SpEL 上下文 创建并初始化 SpEL 上下文环境,包括: 1.
|
static Object |
parseExpression(String spel,
org.springframework.expression.spel.support.StandardEvaluationContext context)
解析表达式为对象
|
static Object[] |
parseParamStrToValArr(LogSpelEvaluationContext logRecordContext,
String paramNames)
将参数字符串转换为参数值数组 支持逗号分隔的多个参数表达式
|
static boolean |
parseParamToBoolean(String spel,
org.springframework.expression.spel.support.StandardEvaluationContext context)
解析表达式为布尔值
|
static String |
parseParamToString(String spel,
org.springframework.expression.spel.support.StandardEvaluationContext context)
解析表达式为字符串
|
static String |
parseParamToStringOrJson(String spel,
org.springframework.expression.spel.support.StandardEvaluationContext context)
解析表达式为字符串或 JSON 如果结果不是字符串类型,则转换为 JSON 字符串
|
static void |
registerGlobalParam(org.springframework.expression.spel.support.StandardEvaluationContext logRecordContext)
注册全局变量参数 将 LogRecordContext 中的变量注册到 SpEL 上下文中
|
public static LogSpelEvaluationContext buildSpelContext(Object target, Method method, Object[] args)
target - 目标对象method - 方法args - 参数public static void registerGlobalParam(org.springframework.expression.spel.support.StandardEvaluationContext logRecordContext)
logRecordContext - SpEL 上下文public static boolean parseParamToBoolean(String spel, org.springframework.expression.spel.support.StandardEvaluationContext context)
spel - SpEL 表达式context - SpEL 上下文public static Object parseExpression(String spel, org.springframework.expression.spel.support.StandardEvaluationContext context)
spel - SpEL 表达式context - SpEL 上下文public static String parseParamToString(String spel, org.springframework.expression.spel.support.StandardEvaluationContext context)
spel - SpEL 表达式context - SpEL 上下文public static String parseParamToStringOrJson(String spel, org.springframework.expression.spel.support.StandardEvaluationContext context)
spel - SpEL 表达式context - SpEL 上下文public static Object[] parseParamStrToValArr(LogSpelEvaluationContext logRecordContext, String paramNames)
logRecordContext - SpEL 上下文paramNames - 参数名字符串,逗号分隔Copyright © 2025. All rights reserved.