Spring全家桶系列之漸入佳境

Spring全家桶系列——[SpringBoot漸入佳境]
 

萌新:小哥,我在實體類寫了那麼多get/set方法,看着很迷茫
小哥:那不是可以自動生成嗎?
萌新:雖然可以自動生成,但是如果我要修改某個變量的數據類型,我豈不是還要去修改get/set方法?
小哥:哈哈,那我今天給你說一個插件,lombok可以解決你的問題

1.Lombok插件
對於開發人員來說,我要解釋這個什麼意思,你肯定也是一知半解,直接來代碼解釋吧

1.1 代碼演示
package com.example.entity;

public class Area {
    private Integer id;

    private Integer postalcode;

    private String address;

    private Integer type;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPostalcode() {
        return postalcode;
    }

    public void setPostalcode(Integer postalcode) {
        this.postalcode = postalcode;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }
}

繼續查看請打開原文鏈接:

https://blog.csdn.net/weixin_38405253/article/details/84316923

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章