From 642dad3f0c13a8a900aac21fe26e1eb672fbb5a6 Mon Sep 17 00:00:00 2001
From: Reinier Zwitserloot @Data(staticConstructor="of") class Foo<T> { private T x;}
you can create new instances of Foo
by writing: Foo.of(5);
instead of having to write: new Foo<Integer>(5);
.
Arrays are 'deep' compared/printed/hashCoded, which means that arrays that contain themselves will result in StackOverflowError
s. However,
@@ -49,7 +63,7 @@
You may safely presume that the hashCode implementation used will not change between versions of lombok, however this guarantee is not set in stone;
if there's a significant performance improvement to be gained from using an alternate hash algorithm, that will be substituted in a future version.
- For a general idea of how lombok generated the equals
, hashCode
, and toString
methods, check the example below.
+ For a general idea of how lombok generated the equals
, hashCode
, and toString
methods, check the example after.
For the purposes of equality, 2 NaN
(not a number) values for floats and doubles are considered equal, eventhough 'NaN == NaN' would
return false. This is analogous to java.lang.Double
's equals method, and is in fact required to ensure that comparing an object
@@ -57,19 +71,8 @@
boolean
). A default setter is named setFoo
if the field is called foo
, returns void
,
and takes 1 parameter of the same type as the field. It simply sets the field to this value.
- The generated getter/setter method will be public
unless you explicitly specify an AccessLevel
, as shown in the example below.
+ The generated getter/setter method will be public
unless you explicitly specify an AccessLevel
, as shown in the example above.
Legal access levels are PUBLIC
, PROTECTED
, PACKAGE
, and PRIVATE
.
For generating the method names, the first character of the field, if it is a lowercase character, is title-cased, otherwise, it is left unmodified. @@ -37,19 +51,8 @@
@Getter
/ @Setter
public int getFoo() {return foo;}
again.@Data
toString
, hashCode
, equals
, a constructor, and getters and setters
+ from just the fields in your class.@Cleanup
close()
methods safely with no hassle.@Synchronized
synchronized
done right: Don't expose your locks.@SneakyThrows