eclipse环境下:lombok安装及使用
lombok官网:https://projectlombok.org/
jar包下载路径:https://projectlombok.org/download
lombok features:https://projectlombok.org/features/all
lombok:通过注解方式减少POJO类的getter和setter等方法来消除冗余代码量
安装
1.下载 lombok.jar
2.官网说是可以双击安装,,,我用这种方法不可行
2.手动安装
(1)将lombok.jar移到eclipse的安装目录
(2)在eclipse.in文件最后加入下面两行
-Xbootclasspath/a:lombok.jar -javaagent:lombok.jar
=============
-javaagent:xxx.jar 的jar名称 需要与根目录下的jar名一致,
不一致,可能会出现eclipse无法启动的情况。
(3)重启eclipse,进行代码测试
原始java代码:
public class NoteTest { private int noteId; private String title; private String content; private int typeId; }
class文件反编译后:
public class NoteTest { private int noteId; private String title; private String content; private int typeId; public NoteTest() {
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
加入lombok注解后的java代码:
@Data @NoArgsConstructor @AllArgsConstructor @ToString(exclude="typeId") public class NoteTest { private int noteId; private String title; private String content; private int typeId; }
加注解,经反编译:
public class NoteTest { private int noteId; private String title; private String content; private int typeId; public int getNoteId() { return noteId; } public String getTitle() { return title; } public String getContent() { return content; } public int getTypeId() { return typeId; } public void setNoteId(int noteId) { this.noteId = noteId; } public void setTitle(String title) { this.title = title; } public void setContent(String content) { this.content = content; } public void setTypeId(int typeId) { this.typeId = typeId; } public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof NoteTest)) return false; NoteTest other = (NoteTest)o; if (!other.canEqual(this)) return false; if (getNoteId() != other.getNoteId()) return false; Object this$title = getTitle(); Object other$title = other.getTitle(); if (this$title != null ? !this$title.equals(other$title) : other$title != null) return false; Object this$content = getContent(); Object other$content = other.getContent(); if (this$content != null ? !this$content.equals(other$content) : other$content != null) return false; return getTypeId() == other.getTypeId(); } protected boolean canEqual(Object other) { return other instanceof NoteTest; } public int hashCode() { int PRIME = 59; int result = 1; result = result * 59 + getNoteId(); Object $title = getTitle(); result = result * 59 + ($title != null ? $title.hashCode() : 43); Object $content = getContent(); result = result * 59 + ($content != null ? $content.hashCode() : 43); result = result * 59 + getTypeId(); return result; } public NoteTest() { } public NoteTest(int noteId, String title, String content, int typeId) { this.noteId = noteId; this.title = title; this.content = content; this.typeId = typeId; } public String toString() { return (new StringBuilder("NoteTest(noteId=")).append(getNoteId()).append(", title=").append(getTitle()).append(", content=").append(getContent()).append(")").toString(); } }
欢迎大家一起说出自己的想法。
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
C# 编写的SqlServer 数据库自动备份服务,带配置,功能强大
原文: C# 编写的SqlServer 数据库自动备份服务,带配置,功能强大 数据库自动备份服务,带配置,还算可以吧 周末抽时间,编写了一个这样的工具,可以让,对数据库不了解或不熟悉的人,直接学会使用备份,省时省力,同样,我也将一份,通过脚本进行备份的,也奉献上来, 通过sql脚本进行数据库备份 通过脚本备份数据库,同样也支持压缩,但是需要安装winrar来实现,整体来说也还行,在服务器上创建一个维护计划,就可以实现,也是很方便的,脚本如下: EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; declare @prefix nvarchar(100), @datefile nvarchar(100), @bakfile nvarchar(100), @rarfile nvarchar(100), @rarcmd nvarchar(150), @str_date nvarchar(100), @sql nvarchar(10...
- 下一篇
在win10下安装scrapy
在win下安装scrapy中,经常会遇到报错,building twisted.test.raiser.提示到网址安装Visual C++ Build Tools,1是这个包比较大,2是访问的时候,是404,页面不存在了。幸好https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted ,已经给我们集成了这个包,可以跳过这库的安装。找到对应版本的Twisted并下载到你的文件夹,并运行pip install之后再运行pip install scrapy即可安装成功了
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- CentOS8安装Docker,最新的服务器搭配容器使用
- Linux系统CentOS6、CentOS7手动修改IP地址
- CentOS7安装Docker,走上虚拟化容器引擎之路
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- Docker安装Oracle12C,快速搭建Oracle学习环境
- Docker使用Oracle官方镜像安装(12C,18C,19C)
- CentOS7,8上快速安装Gitea,搭建Git服务器
- MySQL8.0.19开启GTID主从同步CentOS8
- SpringBoot2配置默认Tomcat设置,开启更多高级功能
- CentOS8编译安装MySQL8.0.19