This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SneakyThrows | |
public void testSneakyThrows() { | |
throw new IllegalAccessException(); | |
} | |
public void testSneakyThrows() { | |
try { | |
throw new IllegalAccessException(); | |
} catch (java.lang.Throwable $ex) { | |
throw lombok.Lombok.sneakyThrow($ex); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private DateFormat format = new SimpleDateFormat("MM-dd-YYYY"); | |
@Synchronized | |
public String synchronizedFormat(Date date) { | |
return format.format(date); | |
} | |
private final java.lang.Object $lock = new java.lang.Object[0]; | |
private DateFormat format = new SimpleDateFormat("MM-dd-YYYY"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testCleanUp() { | |
try { | |
@Cleanup ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
baos.write(new byte[] {'Y','e','s'}); | |
System.out.println(baos.toString()); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Data(staticConstructor="of") | |
public class Company { | |
private final Person founder; | |
private String name; | |
private List<Person> employees; | |
} | |
public class Company { | |
private final Person founder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Getter @Setter @NonNull | |
private List<Person> members; | |
@NonNull | |
private List<Person> members; | |
public Family(@NonNull final List<Person> members) { | |
if (members == null) throw new java.lang.NullPointerException("members"); | |
this.members = members; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Getter @Setter private boolean employed = true; | |
@Setter(AccessLevel.PROTECTED) private String name; | |
private boolean employed = true; | |
private String name; | |
public boolean isEmployed() { | |
return employed; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EqualsAndHashCode(callSuper=true,exclude={"address","city","state","zip"}) | |
public class Person extends SentientBeing { | |
enum Gender { Male, Female } | |
@NonNull private String name; | |
@NonNull private Gender gender; | |
private String ssn; | |
private String address; | |
private String city; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ToString(callSuper=true,exclude="someExcludeField") | |
public class Foo extends Bar { | |
private boolean someBoolean = true; | |
private String someStringField; | |
private float someExcludedField; | |
} | |
public class Foo extends Bar { |