Package top.tangyh.basic.echo.core
Class EchoServiceImpl
java.lang.Object
top.tangyh.basic.echo.core.EchoServiceImpl
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,org.springframework.core.env.EnvironmentCapable,EchoService
public class EchoServiceImpl
extends Object
implements EchoService, org.springframework.core.env.EnvironmentCapable, org.springframework.beans.factory.InitializingBean
字典数据回显工具类
1. 通过反射将obj的字段上标记了@Echo注解的字段解析出来
2. 依次查询待回显的数据
3. 将查询出来结果回显到obj的 @Echo注解的字段中
- Author:
- zuihou
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid回显数据的3个步骤:(出现回显失败时,认真debug该方法)voidvoidfinal org.springframework.core.env.Environmentprotected StringresolveBasePackage(String basePackage)
-
Constructor Details
-
EchoServiceImpl
-
-
Method Details
-
resolveBasePackage
-
getEnvironment
public final org.springframework.core.env.Environment getEnvironment()- Specified by:
getEnvironmentin interfaceorg.springframework.core.env.EnvironmentCapable
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
action
- Specified by:
actionin interfaceEchoService
-
action
回显数据的3个步骤:(出现回显失败时,认真debug该方法)1. parse: 通过反射将obj的字段上标记了 @Echo 注解的字段解析出来, 封装到typeMap中 2. load: 依次查询待回显的数据 3. write: 将查询出来的结果 反射或put 到obj的 字段或echoMap 中
注意:若对象中需要回显的字段之间出现循环引用,很可能发生异常,所以请保证不要出现循环引用!!!
- Specified by:
actionin interfaceEchoService- Parameters:
obj- 需要回显的参数,支持 自定义对象(User)、集合(List、Set )、IPage isUseCache- 是否使用内存缓存ignoreFields- 忽略字段
-