1.先给Eclispe安装Lombok插件

首先下载 lombok-1.16.6.jar 这个jar包  存放在系统任意盘里面  我这里是放在  c:\lombok-1.16.6.jar

运行命令

点击 Specify location 选择eclise软件的安装目录

选择好之后 点击instal/update按钮

打开我们eclispe软件的安装目录 里面会多出一个jar文件 lombok.jar

到此插件安装成功

复制eclispe软件下面的 lombok.jar文件到我们项目工程当中 构造环境Build Path

 

因为这个插件我们是经常用的到,所以我们也配置到eclispe User Libary当中去

配置步骤

Window --->Preferences --->搜索 User Libraries

然后给lombok 关联一个jar包

然后给我们项目配置插件

引用之后 代码就不会报错,

以后我们的其它也可以直接引用既可以

其实lombok 是帮助我们生成了这些方法,我们打开字节码来查看一下吧

打开的字节码如下显示

// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: User.java package com.my.bean; public class User
{ private int id;
private String userName;
private String password; public int getId()
{
return id;
} public String getUserName()
{
return userName;
} public String getPassword()
{
return password;
} public void setId(int id)
{
this.id = id;
} public void setUserName(String userName)
{
this.userName = userName;
} public void setPassword(String password)
{
this.password = password;
} public boolean equals(Object o)
{
if (o == this)
return true;
if (!(o instanceof User))
return false;
User other = (User)o;
if (!other.canEqual(this))
return false;
if (getId() != other.getId())
return false;
Object this$userName = getUserName();
Object other$userName = other.getUserName();
if (this$userName != null ? !this$userName.equals(other$userName) : other$userName != null)
return false;
Object this$password = getPassword();
Object other$password = other.getPassword();
return this$password != null ? this$password.equals(other$password) : other$password == null;
} protected boolean canEqual(Object other)
{
return other instanceof User;
} public int hashCode()
{
int PRIME = 59;
int result = 1;
result = result * 59 + getId();
Object $userName = getUserName();
result = result * 59 + ($userName != null ? $userName.hashCode() : 43);
Object $password = getPassword();
result = result * 59 + ($password != null ? $password.hashCode() : 43);
return result;
} public String toString()
{
return (new StringBuilder("User(id=")).append(getId()).append(", userName=").append(getUserName()).append(", password=").append(getPassword()).append(")").toString();
} public User()
{
}
}

现在测试代码就是可以直接使用了

package com.my.test;

import com.my.bean.User;

public class Demo {

    /**
* @param args
*/
public static void main(String[] args) { User u=new User();
u.setUserName("刘诗华");
u.setPassword("xxxxxxxxxxx");
u.setId(100); } }

最新文章

  1. Integer to English Words
  2. PHPCMS后台密码忘记解决办法
  3. WebDriver中启动不同的浏览器
  4. C++学习26 运算符重载的概念和语法
  5. js中数组操作
  6. Android:AlertDialog对话框
  7. Swift计算属性
  8. I - Agri-Net - poj 1258
  9. windows2008无线网卡和.net3.5安装
  10. 《生活在Linux中》之:使用Bash就是使用Emacs
  11. kafka集群中常见错误的解决方法:kafka.common.KafkaException: Should not set log end offset on partition
  12. HDU4027 Can you answer these queries?(线段树 单点修改)
  13. https原理通俗了解
  14. Android官方技术文档翻译——开发工具的构建概述
  15. git 服务器 LINUX端的使用
  16. CP343-1 扩展ProfibusCPU 314C-2DP
  17. java 值传递 数组传递
  18. 牛客网某比赛 I 小乐乐学博弈 博弈论
  19. Nginx server之Nginx添加ssl支持
  20. js 实现遮罩某一部分

热门文章

  1. Load Balancing OpenSSH SFTP with HAProxy
  2. php创建桌面快捷方式实现方法
  3. STM32的ISP下载程序方式:
  4. docker 运行java程序时区问题
  5. Java MyBatis insert数据库数据后返回主键
  6. 小米笔记本装MAC(黑苹果),外接USB蓝牙,禁止笔记本自带的蓝牙方法
  7. PHP 解压 ZIP 文件到指定文件夹
  8. Pandas的使用(1)
  9. Cygwin使用2-心得
  10. vue 导出excel 多个sheet