Intellij IDEA 安装lombok及使用详解

参考
https://blog.youkuaiyun.com/zhglance/article/details/54931430
https://blog.youkuaiyun.com/ghsau/article/details/52334762

跟着https://blog.youkuaiyun.com/zhglance/article/details/54931430步骤做完
这里写图片描述
发现get,set等方法都不能识别,这时需要重启idea,然后idea会提示:
这里写图片描述
需要设置下,才能使用注解的功能,如下:
这里写图片描述
设置好了之后,运行便不再报错。
这里写图片描述
且可以看到Student.class如下:

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

public class Student {
    private String name;
    private int age;
    private String male;
    private String studentNo;

    public Student() {
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setMale(String male) {
        this.male = male;
    }

    public void setStudentNo(String studentNo) {
        this.studentNo = studentNo;
    }

    public String getName() {
        return this.name;
    }

    public int getAge() {
        return this.age;
    }

    public String getMale() {
        return this.male;
    }

    public String getStudentNo() {
        return this.studentNo;
    }

    public String toString() {
        return "Student(name=" + this.getName() + ", age=" + this.getAge() + ", male=" + this.getMale() + ", studentNo=" + this.getStudentNo() + ")";
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof Student)) {
            return false;
        } else {
            Student other = (Student)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$name = this.getName();
                Object other$name = other.getName();
                if (this$name == null) {
                    if (other$name != null) {
                        return false;
                    }
                } else if (!this$name.equals(other$name)) {
                    return false;
                }

                if (this.getAge() != other.getAge()) {
                    return false;
                } else {
                    Object this$male = this.getMale();
                    Object other$male = other.getMale();
                    if (this$male == null) {
                        if (other$male != null) {
                            return false;
                        }
                    } else if (!this$male.equals(other$male)) {
                        return false;
                    }

                    Object this$studentNo = this.getStudentNo();
                    Object other$studentNo = other.getStudentNo();
                    if (this$studentNo == null) {
                        if (other$studentNo != null) {
                            return false;
                        }
                    } else if (!this$studentNo.equals(other$studentNo)) {
                        return false;
                    }

                    return true;
                }
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof Student;
    }

    public int hashCode() {
        int PRIME = true;
        int result = 1;
        Object $name = this.getName();
        int result = result * 59 + ($name == null ? 43 : $name.hashCode());
        result = result * 59 + this.getAge();
        Object $male = this.getMale();
        result = result * 59 + ($male == null ? 43 : $male.hashCode());
        Object $studentNo = this.getStudentNo();
        result = result * 59 + ($studentNo == null ? 43 : $studentNo.hashCode());
        return result;
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值