maaya ishida
I'm system engineer in Tokyo. I join ... - Java Women Group Tokyo - PyLadies Tokyo
損してますよ。
dependencies {
compileOnly 'org.projectlombok:lombok:1.16.10'
}
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
dependencies {
compileOnly 'org.projectlombok:lombok:1.16.10'
}
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
IDEで使う場合はプラグイン入れてあげてね。
import lombok.Data;
@Data
public class JavajoMember {
private String nickname;
private int age;
}
public void addMember (String memberName, int memberAge) {
JavajoMember member = new JavajoMember();
member.setNickname( memberName );
member.setAge( memberAge );
//.... DBに登録とか
}
import lombok.Data;
@Data
public class JavajoMember {
private String nickname;
private int age;
}
public void addMember (String memberName, int memberAge) {
JavajoMember member = new JavajoMember();
member.setNickname( memberName );
member.setAge( memberAge );
//.... DBに登録とか
}
@Slf4j
public class JavajoEvent {
public void errorMessage (String eventName) {
log.error("このイベントはキャンセルになりました : " + evenName);
}
}
public class JavajoEvent {
private static final org.slf4j.Logger log =
org.slf4j.LoggerFactory.getLogger(JavajoEvent.class);
public void errorMessage (String eventName) {
log.error("このイベントはキャンセルになりました : " + evenName);
}
}
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@NoArgsConstructor
public class Halloween {
@NonNull private int year;
@NonNull private String groupName;
}
public class Helloween {
private int year;
private String groupName;
protected Helloween() { }
protected Helloween(int year, String groupName) {
if (groupName == null) {
throw new NullPointerException("groupName");
}
this.year = year;
this.groupName = groupName;
}
}
public class Helloween {
private int year;
@NonNull private String groupName;
protected Helloween() { }
protected Helloween(int year, String groupName) {
if (groupName == null) {
throw new NullPointerException("groupName");
}
this.year = year;
this.groupName = groupName;
}
}
import lombok.NonNull;
public class JavajoMember {
private String name;
public JavajoMember(@NonNull Person person) {
this.name = person.getName();
}
}
public class JavajoMember {
private String name;
public JavajoMember(@NonNull Person person) {
if (person == null) {
throw new NullPointerException("person");
}
this.name = person.getName();
}
}
By maaya ishida
I'm system engineer in Tokyo. I join ... - Java Women Group Tokyo - PyLadies Tokyo