public final class ActionContextUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
convertActionContext(String key,
Object value,
Class<T> targetClazz)
Convert action context
|
static Map<String,Object> |
fetchContextFromObject(Object targetParam)
Extracting context data from parameters
|
static String |
getParamNameFromAnnotation(BusinessActionContextParameter annotation) |
static Object |
handleActionContext(Object actionContext)
Handle the action context.
|
static void |
loadParamByAnnotationAndPutToContext(ParamType paramType,
String paramName,
Object paramValue,
BusinessActionContextParameter annotation,
Map<String,Object> actionContext)
load param by the config of annotation, and then put into the action context
|
static boolean |
putActionContext(Map<String,Object> actionContext,
Map<String,Object> actionContextMap)
put the action context after handle
|
static boolean |
putActionContext(Map<String,Object> actionContext,
String key,
Object value)
put the action context after handle
|
static boolean |
putActionContextWithoutHandle(Map<String,Object> actionContext,
Map<String,Object> actionContextMap)
put the action context without handle
|
static boolean |
putActionContextWithoutHandle(Map<String,Object> actionContext,
String key,
Object value)
put the action context without handle
|
public static Map<String,Object> fetchContextFromObject(@Nonnull Object targetParam)
targetParam - the target parampublic static void loadParamByAnnotationAndPutToContext(@Nonnull ParamType paramType, @Nonnull String paramName, Object paramValue, @Nonnull BusinessActionContextParameter annotation, @Nonnull Map<String,Object> actionContext)
paramType - the param type, 'param' or 'field'paramName - the param nameparamValue - the param valueannotation - the annotation on the param or fieldactionContext - the action contextpublic static String getParamNameFromAnnotation(@Nonnull BusinessActionContextParameter annotation)
public static boolean putActionContext(Map<String,Object> actionContext, String key, Object value)
actionContext - the action contextkey - the actionContext's keyvalue - the actionContext's valuepublic static boolean putActionContext(Map<String,Object> actionContext, @Nonnull Map<String,Object> actionContextMap)
actionContext - the action contextactionContextMap - the actionContextMappublic static boolean putActionContextWithoutHandle(@Nonnull Map<String,Object> actionContext, String key, Object value)
actionContext - the action contextkey - the actionContext's keyvalue - the actionContext's valuepublic static boolean putActionContextWithoutHandle(Map<String,Object> actionContext, @Nonnull Map<String,Object> actionContextMap)
actionContext - the action contextactionContextMap - the actionContextMappublic static Object handleActionContext(@Nonnull Object actionContext)
actionContext - the action contextconvertActionContext(String, Object, Class),
BusinessActionContext.getActionContext(String, Class)public static <T> T convertActionContext(String key, @Nullable Object value, @Nonnull Class<T> targetClazz)
T - the target typekey - the actionContext's keyvalue - the actionContext's valuetargetClazz - the target classCopyright © 2022 Seata. All rights reserved.