GeezerVison is showing github.com — Merge branch 'jackson3-final-touches' · projectlombok/lombok@2be766c
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/core/lombok/core/configuration/JacksonVersion.java +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -26,6 +26,9 @@ public enum JacksonVersion implements MappedConfigEnum { | 26 | 26 | THREE, | 27 | 27 | ; | 28 | 28 |
| | 29 | + public static final String AMBIGUOUS_JACKSON_VERSION_WARNING_TEXT = | | 30 | + "Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized"; | | 31 | + | 29 | 32 | @Override public boolean matches(String value) { | 30 | 33 | if (this == TWO) return "2".equals(value); | 31 | 34 | return "3".equals(value); | |
Collapse file Copy file name to clipboardExpand all lines: src/core/lombok/core/handlers/HandlerUtil.java +7-1Lines changed: 7 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -453,6 +453,9 @@ public static int primeForNull() { | 453 | 453 | "com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper", | 454 | 454 | "com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty", | 455 | 455 | "com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText", | | 456 | + "tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper", | | 457 | + "tools.jackson.dataformat.xml.annotation.JacksonXmlProperty", | | 458 | + "tools.jackson.dataformat.xml.annotation.JacksonXmlText", | 456 | 459 | })); | 457 | 460 | JACKSON_COPY_TO_SETTER_ANNOTATIONS = Collections.unmodifiableList(Arrays.asList(new String[] { | 458 | 461 | "com.fasterxml.jackson.annotation.JacksonInject", | @@ -467,10 +470,13 @@ public static int primeForNull() { | 467 | 470 | "com.fasterxml.jackson.annotation.JsonUnwrapped", | 468 | 471 | "com.fasterxml.jackson.annotation.JsonView", | 469 | 472 | "com.fasterxml.jackson.databind.annotation.JsonDeserialize", | 470 | | - "tools.jackson.databind.annotation.JsonDeserialize", | 471 | 473 | "com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper", | 472 | 474 | "com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty", | 473 | 475 | "com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText", | | 476 | + "tools.jackson.databind.annotation.JsonDeserialize", | | 477 | + "tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper", | | 478 | + "tools.jackson.dataformat.xml.annotation.JacksonXmlProperty", | | 479 | + "tools.jackson.dataformat.xml.annotation.JacksonXmlText", | 474 | 480 | })); | 475 | 481 | JACKSON_COPY_TO_BUILDER_SINGULAR_SETTER_ANNOTATIONS = Collections.unmodifiableList(Arrays.asList(new String[] { | 476 | 482 | "com.fasterxml.jackson.annotation.JsonAnySetter", | |
Collapse file Copy file name to clipboardExpand all lines: src/core/lombok/eclipse/handlers/HandleJacksonized.java +14-12Lines changed: 14 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,17 +90,19 @@ static boolean hasAnnotation(EclipseNode node, JacksonAnnotationType annotation) | 90 | 90 | return; | 91 | 91 | } | 92 | 92 |
| | 93 | + List<JacksonVersion> jacksonVersions = readConfiguredJacksonVersions(annotationNode); | | 94 | + | 93 | 95 | boolean jacksonizedBuilder = builderAnnotationNode != null || superBuilderAnnotationNode != null; | 94 | 96 | if (jacksonizedBuilder) { | 95 | | - handleJacksonizedBuilder(ast, annotationNode, annotatedNode, tdNode, td, builderAnnotationNode, superBuilderAnnotationNode); | | 97 | + handleJacksonizedBuilder(ast, annotationNode, annotatedNode, tdNode, td, builderAnnotationNode, superBuilderAnnotationNode, jacksonVersions); | 96 | 98 | } | 97 | 99 |
| 98 | 100 | if (accessorsAnnotationNode != null) { | 99 | 101 | handleJacksonizedAccessors(ast, annotationNode, annotatedNode, tdNode, td, accessorsAnnotationNode, jacksonizedBuilder); | 100 | 102 | } | 101 | 103 | } | 102 | 104 |
| 103 | | - private void handleJacksonizedBuilder(Annotation ast, EclipseNode annotationNode, EclipseNode annotatedNode, EclipseNode tdNode, TypeDeclaration td, EclipseNode builderAnnotationNode, EclipseNode superBuilderAnnotationNode) { | | 105 | + private void handleJacksonizedBuilder(Annotation ast, EclipseNode annotationNode, EclipseNode annotatedNode, EclipseNode tdNode, TypeDeclaration td, EclipseNode builderAnnotationNode, EclipseNode superBuilderAnnotationNode, List<JacksonVersion> jacksonVersions) { | 104 | 106 | boolean isAbstract = (td.modifiers & ClassFileConstants.AccAbstract) != 0; | 105 | 107 | if (isAbstract) { | 106 | 108 | annotationNode.addError("Builders on abstract classes cannot be @Jacksonized (the builder would never be used)."); | @@ -141,13 +143,6 @@ private void handleJacksonizedBuilder(Annotation ast, EclipseNode annotationNode | 141 | 143 | ClassLiteralAccess builderClassLiteralAccess = new ClassLiteralAccess(td.sourceEnd, builderClassExpression); | 142 | 144 | MemberValuePair builderMvp = new MemberValuePair("builder".toCharArray(), td.sourceStart, td.sourceEnd, builderClassLiteralAccess); | 143 | 145 |
| 144 | | - List<JacksonVersion> jacksonVersions = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, Arrays.<JacksonVersion>asList()); | 145 | | - | 146 | | - if (jacksonVersions.isEmpty()) { | 147 | | - annotationNode.addWarning("Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized"); | 148 | | - jacksonVersions = Arrays.asList(JacksonVersion.TWO); | 149 | | - } | 150 | | - | 151 | 146 | if (jacksonVersions.contains(JacksonVersion.TWO)) { | 152 | 147 | td.annotations = addAnnotation(td, td.annotations, JacksonAnnotationType.JSON_DESERIALIZE2.getQualifiednameAsCharArrayArray(), builderMvp); | 153 | 148 | } | @@ -193,7 +188,7 @@ private void handleJacksonizedAccessors(Annotation ast, EclipseNode annotationNo | 193 | 188 | // Add @JsonProperty to all fields. It will be automatically copied to the getter/setters later. | 194 | 189 | for (EclipseNode eclipseNode : tdNode.down()) { | 195 | 190 | if (eclipseNode.getKind() == Kind.FIELD) { | 196 | | - if (hasAnnotation(eclipseNode, JacksonAnnotationType.JSON_PROPERTY2) || | | 191 | + if (hasAnnotation(eclipseNode, JacksonAnnotationType.JSON_PROPERTY2) || | 197 | 192 | hasAnnotation(eclipseNode, JacksonAnnotationType.JSON_IGNORE2)) { | 198 | 193 | continue; | 199 | 194 | } | @@ -212,15 +207,15 @@ private void createJsonPropertyForField(EclipseNode fieldNode, EclipseNode annot | 212 | 207 | if (astNode instanceof FieldDeclaration) { | 213 | 208 | FieldDeclaration fd = (FieldDeclaration) astNode; | 214 | 209 | StringLiteral fieldName = new StringLiteral(fd.name, 0, 0, 0); | 215 | | - ((FieldDeclaration) astNode).annotations = addAnnotation(fieldNode.get(), fd.annotations, JacksonAnnotationType.JSON_PROPERTY2.getQualifiednameAsCharArrayArray(), fieldName); | | 210 | + fd.annotations = addAnnotation(fieldNode.get(), fd.annotations, JacksonAnnotationType.JSON_PROPERTY2.getQualifiednameAsCharArrayArray(), fieldName); | 216 | 211 | } | 217 | 212 | } | 218 | 213 |
| 219 | 214 | private void createJsonIgnoreForField(EclipseNode fieldNode, EclipseNode annotationNode) { | 220 | 215 | ASTNode astNode = fieldNode.get(); | 221 | 216 | if (astNode instanceof FieldDeclaration) { | 222 | 217 | FieldDeclaration fd = (FieldDeclaration) astNode; | 223 | | - ((FieldDeclaration) astNode).annotations = addAnnotation(fieldNode.get(), fd.annotations, JacksonAnnotationType.JSON_IGNORE2.getQualifiednameAsCharArrayArray()); | | 218 | + fd.annotations = addAnnotation(fieldNode.get(), fd.annotations, JacksonAnnotationType.JSON_IGNORE2.getQualifiednameAsCharArrayArray()); | 224 | 219 | } | 225 | 220 | } | 226 | 221 |
| @@ -248,6 +243,13 @@ private String getBuilderClassName(Annotation ast, EclipseNode annotationNode, E | 248 | 243 | return builderClassName; | 249 | 244 | } | 250 | 245 |
| | 246 | + private List<JacksonVersion> readConfiguredJacksonVersions(EclipseNode annotationNode) { | | 247 | + List<JacksonVersion> jacksonVersions = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, Arrays.<JacksonVersion>asList()); | | 248 | + if (!jacksonVersions.isEmpty()) return jacksonVersions; | | 249 | + annotationNode.addWarning(JacksonVersion.AMBIGUOUS_JACKSON_VERSION_WARNING_TEXT); | | 250 | + return Arrays.asList(JacksonVersion.TWO); | | 251 | + } | | 252 | + | 251 | 253 | private static final Annotation[] EMPTY_ANNOTATIONS_ARRAY = new Annotation[0]; | 252 | 254 |
| 253 | 255 | private static Annotation[] findJacksonAnnotationsOnClass(TypeDeclaration td, EclipseNode node) { | |
Collapse file Copy file name to clipboardExpand all lines: src/core/lombok/javac/handlers/HandleJacksonized.java +22-20Lines changed: 22 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -114,9 +114,10 @@ private void handleJacksonizedAccessors(JavacNode annotationNode, JavacNode anno | 114 | 114 |
| 115 | 115 | // Add @JsonProperty to all non-transient fields. It will be automatically copied to the getter/setters later. | 116 | 116 | // Add @JsonIgnore to all transient fields. It will be automatically copied to the getter/setters later. | | 117 | + readConfiguredJacksonVersions(annotationNode); | 117 | 118 | for (JavacNode javacNode : tdNode.down()) { | 118 | 119 | if (javacNode.getKind() == Kind.FIELD) { | 119 | | - if (hasAnnotation(javacNode, JacksonAnnotationType.JSON_PROPERTY2) || | | 120 | + if (hasAnnotation(javacNode, JacksonAnnotationType.JSON_PROPERTY2) || | 120 | 121 | hasAnnotation(javacNode, JacksonAnnotationType.JSON_IGNORE2)) { | 121 | 122 | continue; | 122 | 123 | } | @@ -131,22 +132,21 @@ private void handleJacksonizedAccessors(JavacNode annotationNode, JavacNode anno | 131 | 132 |
| 132 | 133 | private void createJsonPropertyForField(JavacNode fieldNode, JavacNode annotationNode) { | 133 | 134 | JavacTreeMaker maker = fieldNode.getTreeMaker(); | 134 | | - | 135 | | - JCExpression jsonPropertyType = chainDots(fieldNode, JacksonAnnotationType.JSON_PROPERTY2); | 136 | | - JCAnnotation annotationJsonProperty = maker.Annotation(jsonPropertyType, List.<JCExpression>of(maker.Literal(fieldNode.getName()))); | 137 | | - recursiveSetGeneratedBy(annotationJsonProperty, annotationNode); | 138 | | - JCVariableDecl fieldDecl = ((JCVariableDecl)fieldNode.get()); | 139 | | - fieldDecl.mods.annotations = fieldDecl.mods.annotations.append(annotationJsonProperty); | | 135 | + List<JCExpression> args = List.<JCExpression>of(maker.Literal(fieldNode.getName())); | | 136 | + addFieldAnnotation(fieldNode, annotationNode, JacksonAnnotationType.JSON_PROPERTY2, args); | 140 | 137 | } | 141 | 138 |
| 142 | 139 | private void createJsonIgnoreForField(JavacNode fieldNode, JavacNode annotationNode) { | | 140 | + addFieldAnnotation(fieldNode, annotationNode, JacksonAnnotationType.JSON_IGNORE2, List.<JCExpression>nil()); | | 141 | + } | | 142 | + | | 143 | + private void addFieldAnnotation(JavacNode fieldNode, JavacNode annotationNode, JacksonAnnotationType annotationType, List<JCExpression> args) { | 143 | 144 | JavacTreeMaker maker = fieldNode.getTreeMaker(); | 144 | | - | 145 | | - JCExpression jsonPropertyType = chainDots(fieldNode, JacksonAnnotationType.JSON_IGNORE2); | 146 | | - JCAnnotation annotationJsonProperty = maker.Annotation(jsonPropertyType, List.<JCExpression>nil()); | 147 | | - recursiveSetGeneratedBy(annotationJsonProperty, annotationNode); | 148 | | - JCVariableDecl fieldDecl = ((JCVariableDecl)fieldNode.get()); | 149 | | - fieldDecl.mods.annotations = fieldDecl.mods.annotations.append(annotationJsonProperty); | | 145 | + JCExpression type = chainDots(fieldNode, annotationType); | | 146 | + JCAnnotation annotation = maker.Annotation(type, args); | | 147 | + recursiveSetGeneratedBy(annotation, annotationNode); | | 148 | + JCVariableDecl fieldDecl = (JCVariableDecl) fieldNode.get(); | | 149 | + fieldDecl.mods.annotations = fieldDecl.mods.annotations.append(annotation); | 150 | 150 | } | 151 | 151 |
| 152 | 152 | private void handleJacksonizedBuilder(JavacNode annotationNode, JavacNode annotatedNode, JavacNode tdNode, JCClassDecl td, JavacNode builderAnnotationNode, JavacNode superBuilderAnnotationNode) { | @@ -191,19 +191,14 @@ private void handleJacksonizedBuilder(JavacNode annotationNode, JavacNode annota | 191 | 191 | return; | 192 | 192 | } | 193 | 193 |
| | 194 | + Collection<JacksonVersion> jacksonVersions = readConfiguredJacksonVersions(annotationNode); | | 195 | + | 194 | 196 | // Insert @JsonDeserialize on annotated class. | 195 | 197 | if (hasAnnotation(tdNode, JacksonAnnotationType.JSON_DESERIALIZE2) || hasAnnotation(tdNode, JacksonAnnotationType.JSON_DESERIALIZE3)) { | 196 | 198 | annotationNode.addError("@JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson."); | 197 | 199 | return; | 198 | 200 | } | 199 | 201 |
| 200 | | - Collection<JacksonVersion> jacksonVersions = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, Arrays.<JacksonVersion>asList()); | 201 | | - | 202 | | - if (jacksonVersions.isEmpty()) { | 203 | | - annotationNode.addWarning("Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized"); | 204 | | - jacksonVersions = Arrays.asList(JacksonVersion.TWO); | 205 | | - } | 206 | | - | 207 | 202 | if (jacksonVersions.contains(JacksonVersion.TWO)) { | 208 | 203 | JCExpression jsonDeserializeType = chainDots(annotatedNode, JacksonAnnotationType.JSON_DESERIALIZE2); | 209 | 204 | insertJsonDeserializeAnnotation(annotationNode, annotatedNode, tdNode, td, maker, builderClassName, jsonDeserializeType); | @@ -280,6 +275,13 @@ private String getBuilderClassName(JavacNode annotationNode, JavacNode annotated | 280 | 275 | return builderClassName; | 281 | 276 | } | 282 | 277 |
| | 278 | + private Collection<JacksonVersion> readConfiguredJacksonVersions(JavacNode annotationNode) { | | 279 | + Collection<JacksonVersion> jacksonVersions = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, Arrays.<JacksonVersion>asList()); | | 280 | + if (!jacksonVersions.isEmpty()) return jacksonVersions; | | 281 | + annotationNode.addWarning(JacksonVersion.AMBIGUOUS_JACKSON_VERSION_WARNING_TEXT); | | 282 | + return Arrays.asList(JacksonVersion.TWO); | | 283 | + } | | 284 | + | 283 | 285 | private static List<JCAnnotation> findJacksonAnnotationsOnClass(JavacNode node) { | 284 | 286 | ListBuffer<JCAnnotation> result = new ListBuffer<JCAnnotation>(); | 285 | 287 | for (JavacNode child : node.down()) { | |
Collapse file Copy file name to clipboard +109Lines changed: 109 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +//version 8: Jackson deps are at least Java7+. | | 2 | +//CONF: lombok.jacksonized.jacksonVersion += 3 | | 3 | +class JacksonizedAccessorsJackson3 { | | 4 | + @com.fasterxml.jackson.annotation.JsonProperty("name") | | 5 | + private String name; | | 6 | + @com.fasterxml.jackson.annotation.JsonProperty("age") | | 7 | + private int age; | | 8 | + @com.fasterxml.jackson.annotation.JsonIgnore | | 9 | + private transient String password; | | 10 | + | | 11 | + @java.lang.SuppressWarnings("all") | | 12 | + @lombok.Generated | | 13 | + public JacksonizedAccessorsJackson3() { | | 14 | + } | | 15 | + | | 16 | + @com.fasterxml.jackson.annotation.JsonProperty("name") | | 17 | + @java.lang.SuppressWarnings("all") | | 18 | + @lombok.Generated | | 19 | + public String name() { | | 20 | + return this.name; | | 21 | + } | | 22 | + | | 23 | + @com.fasterxml.jackson.annotation.JsonProperty("age") | | 24 | + @java.lang.SuppressWarnings("all") | | 25 | + @lombok.Generated | | 26 | + public int age() { | | 27 | + return this.age; | | 28 | + } | | 29 | + | | 30 | + @com.fasterxml.jackson.annotation.JsonIgnore | | 31 | + @java.lang.SuppressWarnings("all") | | 32 | + @lombok.Generated | | 33 | + public String password() { | | 34 | + return this.password; | | 35 | + } | | 36 | + | | 37 | + /** | | 38 | + * @return {@code this}. | | 39 | + */ | | 40 | + @com.fasterxml.jackson.annotation.JsonProperty("name") | | 41 | + @java.lang.SuppressWarnings("all") | | 42 | + @lombok.Generated | | 43 | + public JacksonizedAccessorsJackson3 name(final String name) { | | 44 | + this.name = name; | | 45 | + return this; | | 46 | + } | | 47 | + | | 48 | + /** | | 49 | + * @return {@code this}. | | 50 | + */ | | 51 | + @com.fasterxml.jackson.annotation.JsonProperty("age") | | 52 | + @java.lang.SuppressWarnings("all") | | 53 | + @lombok.Generated | | 54 | + public JacksonizedAccessorsJackson3 age(final int age) { | | 55 | + this.age = age; | | 56 | + return this; | | 57 | + } | | 58 | + | | 59 | + /** | | 60 | + * @return {@code this}. | | 61 | + */ | | 62 | + @com.fasterxml.jackson.annotation.JsonIgnore | | 63 | + @java.lang.SuppressWarnings("all") | | 64 | + @lombok.Generated | | 65 | + public JacksonizedAccessorsJackson3 password(final String password) { | | 66 | + this.password = password; | | 67 | + return this; | | 68 | + } | | 69 | + | | 70 | + @java.lang.Override | | 71 | + @java.lang.SuppressWarnings("all") | | 72 | + @lombok.Generated | | 73 | + public boolean equals(final java.lang.Object o) { | | 74 | + if (o == this) return true; | | 75 | + if (!(o instanceof JacksonizedAccessorsJackson3)) return false; | | 76 | + final JacksonizedAccessorsJackson3 other = (JacksonizedAccessorsJackson3) o; | | 77 | + if (!other.canEqual((java.lang.Object) this)) return false; | | 78 | + if (this.age() != other.age()) return false; | | 79 | + final java.lang.Object this$name = this.name(); | | 80 | + final java.lang.Object other$name = other.name(); | | 81 | + if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false; | | 82 | + return true; | | 83 | + } | | 84 | + | | 85 | + @java.lang.SuppressWarnings("all") | | 86 | + @lombok.Generated | | 87 | + protected boolean canEqual(final java.lang.Object other) { | | 88 | + return other instanceof JacksonizedAccessorsJackson3; | | 89 | + } | | 90 | + | | 91 | + @java.lang.Override | | 92 | + @java.lang.SuppressWarnings("all") | | 93 | + @lombok.Generated | | 94 | + public int hashCode() { | | 95 | + final int PRIME = 59; | | 96 | + int result = 1; | | 97 | + result = result * PRIME + this.age(); | | 98 | + final java.lang.Object $name = this.name(); | | 99 | + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); | | 100 | + return result; | | 101 | + } | | 102 | + | | 103 | + @java.lang.Override | | 104 | + @java.lang.SuppressWarnings("all") | | 105 | + @lombok.Generated | | 106 | + public java.lang.String toString() { | | 107 | + return "JacksonizedAccessorsJackson3(name=" + this.name() + ", age=" + this.age() + ", password=" + this.password() + ")"; | | 108 | + } | | 109 | +} |
Collapse file Copy file name to clipboard +68Lines changed: 68 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +@lombok.Data @lombok.experimental.Accessors(fluent = true) @lombok.extern.jackson.Jacksonized class JacksonizedAccessorsJackson3 { | | 2 | + private @com.fasterxml.jackson.annotation.JsonProperty("name") String name; | | 3 | + private @com.fasterxml.jackson.annotation.JsonProperty("age") int age; | | 4 | + private transient @com.fasterxml.jackson.annotation.JsonIgnore String password; | | 5 | + public @com.fasterxml.jackson.annotation.JsonProperty("name") @java.lang.SuppressWarnings("all") @lombok.Generated String name() { | | 6 | + return this.name; | | 7 | + } | | 8 | + public @com.fasterxml.jackson.annotation.JsonProperty("age") @java.lang.SuppressWarnings("all") @lombok.Generated int age() { | | 9 | + return this.age; | | 10 | + } | | 11 | + public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated String password() { | | 12 | + return this.password; | | 13 | + } | | 14 | + /** | | 15 | + * @return {@code this}. | | 16 | + */ | | 17 | + public @com.fasterxml.jackson.annotation.JsonProperty("name") @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3 name(final String name) { | | 18 | + this.name = name; | | 19 | + return this; | | 20 | + } | | 21 | + /** | | 22 | + * @return {@code this}. | | 23 | + */ | | 24 | + public @com.fasterxml.jackson.annotation.JsonProperty("age") @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3 age(final int age) { | | 25 | + this.age = age; | | 26 | + return this; | | 27 | + } | | 28 | + /** | | 29 | + * @return {@code this}. | | 30 | + */ | | 31 | + public @com.fasterxml.jackson.annotation.JsonIgnore @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3 password(final String password) { | | 32 | + this.password = password; | | 33 | + return this; | | 34 | + } | | 35 | + public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated boolean equals(final java.lang.Object o) { | | 36 | + if ((o == this)) | | 37 | + return true; | | 38 | + if ((! (o instanceof JacksonizedAccessorsJackson3))) | | 39 | + return false; | | 40 | + final JacksonizedAccessorsJackson3 other = (JacksonizedAccessorsJackson3) o; | | 41 | + if ((! other.canEqual((java.lang.Object) this))) | | 42 | + return false; | | 43 | + if ((this.age() != other.age())) | | 44 | + return false; | | 45 | + final java.lang.Object this$name = this.name(); | | 46 | + final java.lang.Object other$name = other.name(); | | 47 | + if (((this$name == null) ? (other$name != null) : (! this$name.equals(other$name)))) | | 48 | + return false; | | 49 | + return true; | | 50 | + } | | 51 | + protected @java.lang.SuppressWarnings("all") @lombok.Generated boolean canEqual(final java.lang.Object other) { | | 52 | + return (other instanceof JacksonizedAccessorsJackson3); | | 53 | + } | | 54 | + public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated int hashCode() { | | 55 | + final int PRIME = 59; | | 56 | + int result = 1; | | 57 | + result = ((result * PRIME) + this.age()); | | 58 | + final java.lang.Object $name = this.name(); | | 59 | + result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode())); | | 60 | + return result; | | 61 | + } | | 62 | + public @java.lang.Override @java.lang.SuppressWarnings("all") @lombok.Generated java.lang.String toString() { | | 63 | + return (((((("JacksonizedAccessorsJackson3(name=" + this.name()) + ", age=") + this.age()) + ", password=") + this.password()) + ")"); | | 64 | + } | | 65 | + public @java.lang.SuppressWarnings("all") @lombok.Generated JacksonizedAccessorsJackson3() { | | 66 | + super(); | | 67 | + } | | 68 | +} |
Collapse file Copy file name to clipboard +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +//version 8: Jackson deps are at least Java7+. | | 2 | +//CONF: lombok.jacksonized.jacksonVersion += 3 | | 3 | +@lombok.Data | | 4 | +@lombok.experimental.Accessors(fluent = true) | | 5 | +@lombok.extern.jackson.Jacksonized | | 6 | +class JacksonizedAccessorsJackson3 { | | 7 | + private String name; | | 8 | + private int age; | | 9 | + private transient String password; | | 10 | +} |
Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized |
Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized |
Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +1 Ambiguous: Jackson2 and Jackson3 exist; define which variant(s) you want in 'lombok.config'. See https://projectlombok.org/features/experimental/Jacksonized |
|