c JAVA 注解,GitHub

阅读: 评论:0

c  JAVA 注解,GitHub

c JAVA 注解,GitHub

annotationParser

java 注解解析

按照运行机制分类

源码注解---注解只在源码中存在,编译成.class文件就不存在了

编译时注解---注解在源码和.class文件中都存在(如:JDK内置系统注解:@Override,@Deprecated,@Suppvisewarnings)

运行时注解---在运行阶段还起作用,甚至会影响运行逻辑的注解(如:Spring中@Autowried)

自定义注解语法要求

1.@interface ----表示定义的不是类,也不是接口,是定义注解的关键字

2.支持的类型---基本的数据类型,string,class,Annotation,Enumeration

3.成员变量要以无参无异常的方式声明

4.如果注解只有一个成员,则成员名必须取名为value(),可以忽略成员名和赋值号(=)。

5.注解类可以没有成员---那就是标识注解

解析注解

通过反射获取类,函数或成员上的运行时注解信息,从而实现动态控制程序运行的逻辑。

运行结果Test

select * from user where 1=1 and id=10

select * from user where 1=1 and userName='lucy'

select * from user where 1=1 and email in('xiaoming@sina','13812345678@163','23456789@qq')

运行结果Test2

select * from user where 1=1 and id=10

select * from user where 1=1 and userName='lucy' and age=18

select * from user where 1=1 and email='xiaoming@sina'

select * from department where 1=1 and id=8 and name='技术部' and amount=20

本文发布于:2024-01-31 13:45:54,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170667995328956.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:注解   JAVA   GitHub
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23