Skip to content

Commit

Permalink
feat: Add lombok getter, setter
Browse files Browse the repository at this point in the history
  • Loading branch information
r05323028 committed Jun 29, 2024
1 parent b996ea6 commit c0cecbd
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
4 changes: 0 additions & 4 deletions docs/intro.md → docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 1
---

# Security E

一群山上工程師下班後交流技術的園地
1 change: 1 addition & 0 deletions docs/langs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 程式語言
1 change: 1 addition & 0 deletions docs/langs/java/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Java
39 changes: 39 additions & 0 deletions docs/langs/java/lombok.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Project Lombok

在撰寫 Java 時, 常常會遇到一些看似很冗的程式碼, 但又不得不寫, 此時 Lombok 就派上用場了

## 又愛又恨的 Getter & Setter

大家想必對以下的程式碼不陌生

```java
public class Person {
private String name;
private String job;

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

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

public String getJob() {
return this.job;
}

void setJob(String job) {
this.job = job;
}
}
```

只要在屬性上加上 `@Getter/@Setter` 的標記以後, Lombok 就會在編譯時自動將上述的程式碼產生出來

```java
public class Person {
@Getter @Setter private String name;
@Getter @Setter private String job;
}
```
5 changes: 3 additions & 2 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ const config: Config = {
copyright: `Copyright © ${new Date().getFullYear()} Security E. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
theme: prismThemes.oceanicNext,
darkTheme: prismThemes.oceanicNext,
additionalLanguages: ["java"],
},
} satisfies Preset.ThemeConfig,
};
Expand Down

0 comments on commit c0cecbd

Please sign in to comment.