Is it possible to exclude the class name from Lombok @ToString?
Annotations class project Lombok , @ToString
, is used to automatically create a method toString()
in the class, he says.
For this class:
@ToString
public class SomeClass {
String field1="Field #1";
String field2="Field #2";
}
Calling the generated method toString()
will give this result:
SomeClass(field1="Field #1", field2="Field #2")
Optional annotation elements can be used to include or exclude certain fields, but I want to know that ...
"Is there a way to tell Lombok to exclude the class name from the output?"
Maybe something like:
@ToString(exclude="#classname")
public class SomeClass { ... }
+3
source to share