aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-07-16 01:50:16 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-07-16 01:50:16 +0200
commite1d1415d6e147edacaa50d8954737a168fbdafb5 (patch)
tree5f01ebe2092d8ebf2271beb57cba3874559e1ad1 /test
parentb439e4ce771813a12300c3006f9fcc12f25678d7 (diff)
downloadlombok-e1d1415d6e147edacaa50d8954737a168fbdafb5.tar.gz
lombok-e1d1415d6e147edacaa50d8954737a168fbdafb5.tar.bz2
lombok-e1d1415d6e147edacaa50d8954737a168fbdafb5.zip
[fixes #2168] Added JsonSetter as a copyable annotation
Diffstat (limited to 'test')
-rw-r--r--test/stubs/com/fasterxml/jackson/annotation/JsonSetter.java12
-rw-r--r--test/stubs/com/fasterxml/jackson/annotation/Nulls.java5
-rw-r--r--test/transform/resource/after-delombok/JacksonJsonProperty.java5
-rw-r--r--test/transform/resource/after-ecj/JacksonJsonProperty.java8
-rw-r--r--test/transform/resource/before/JacksonJsonProperty.java3
5 files changed, 30 insertions, 3 deletions
diff --git a/test/stubs/com/fasterxml/jackson/annotation/JsonSetter.java b/test/stubs/com/fasterxml/jackson/annotation/JsonSetter.java
new file mode 100644
index 00000000..2886a6f4
--- /dev/null
+++ b/test/stubs/com/fasterxml/jackson/annotation/JsonSetter.java
@@ -0,0 +1,12 @@
+package com.fasterxml.jackson.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface JsonSetter {
+ Nulls nulls();
+}
diff --git a/test/stubs/com/fasterxml/jackson/annotation/Nulls.java b/test/stubs/com/fasterxml/jackson/annotation/Nulls.java
new file mode 100644
index 00000000..d40bd46d
--- /dev/null
+++ b/test/stubs/com/fasterxml/jackson/annotation/Nulls.java
@@ -0,0 +1,5 @@
+package com.fasterxml.jackson.annotation;
+
+public enum Nulls {
+ SKIP;
+}
diff --git a/test/transform/resource/after-delombok/JacksonJsonProperty.java b/test/transform/resource/after-delombok/JacksonJsonProperty.java
index 842ba298..16a8039e 100644
--- a/test/transform/resource/after-delombok/JacksonJsonProperty.java
+++ b/test/transform/resource/after-delombok/JacksonJsonProperty.java
@@ -1,6 +1,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
public class JacksonJsonProperty {
@JsonProperty("kebab-case-prop")
+ @JsonSetter(nulls = Nulls.SKIP)
public String kebabCaseProp;
@java.lang.SuppressWarnings("all")
JacksonJsonProperty(final String kebabCaseProp) {
@@ -14,6 +17,7 @@ public class JacksonJsonProperty {
JacksonJsonPropertyBuilder() {
}
@JsonProperty("kebab-case-prop")
+ @JsonSetter(nulls = Nulls.SKIP)
@java.lang.SuppressWarnings("all")
public JacksonJsonPropertyBuilder kebabCaseProp(final String kebabCaseProp) {
this.kebabCaseProp = kebabCaseProp;
@@ -34,6 +38,7 @@ public class JacksonJsonProperty {
return new JacksonJsonPropertyBuilder();
}
@JsonProperty("kebab-case-prop")
+ @JsonSetter(nulls = Nulls.SKIP)
@java.lang.SuppressWarnings("all")
public void setKebabCaseProp(final String kebabCaseProp) {
this.kebabCaseProp = kebabCaseProp;
diff --git a/test/transform/resource/after-ecj/JacksonJsonProperty.java b/test/transform/resource/after-ecj/JacksonJsonProperty.java
index 73049b2a..c0485251 100644
--- a/test/transform/resource/after-ecj/JacksonJsonProperty.java
+++ b/test/transform/resource/after-ecj/JacksonJsonProperty.java
@@ -1,4 +1,6 @@
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
import lombok.Builder;
import lombok.Setter;
public @Builder class JacksonJsonProperty {
@@ -7,7 +9,7 @@ public @Builder class JacksonJsonProperty {
@java.lang.SuppressWarnings("all") JacksonJsonPropertyBuilder() {
super();
}
- public @JsonProperty("kebab-case-prop") @java.lang.SuppressWarnings("all") JacksonJsonPropertyBuilder kebabCaseProp(final String kebabCaseProp) {
+ public @JsonProperty("kebab-case-prop") @JsonSetter(nulls = Nulls.SKIP) @java.lang.SuppressWarnings("all") JacksonJsonPropertyBuilder kebabCaseProp(final String kebabCaseProp) {
this.kebabCaseProp = kebabCaseProp;
return this;
}
@@ -18,7 +20,7 @@ public @Builder class JacksonJsonProperty {
return (("JacksonJsonProperty.JacksonJsonPropertyBuilder(kebabCaseProp=" + this.kebabCaseProp) + ")");
}
}
- public @JsonProperty("kebab-case-prop") @Setter String kebabCaseProp;
+ public @JsonProperty("kebab-case-prop") @JsonSetter(nulls = Nulls.SKIP) @Setter String kebabCaseProp;
@java.lang.SuppressWarnings("all") JacksonJsonProperty(final String kebabCaseProp) {
super();
this.kebabCaseProp = kebabCaseProp;
@@ -26,7 +28,7 @@ public @Builder class JacksonJsonProperty {
public static @java.lang.SuppressWarnings("all") JacksonJsonPropertyBuilder builder() {
return new JacksonJsonPropertyBuilder();
}
- public @JsonProperty("kebab-case-prop") @java.lang.SuppressWarnings("all") void setKebabCaseProp(final String kebabCaseProp) {
+ public @JsonProperty("kebab-case-prop") @JsonSetter(nulls = Nulls.SKIP) @java.lang.SuppressWarnings("all") void setKebabCaseProp(final String kebabCaseProp) {
this.kebabCaseProp = kebabCaseProp;
}
} \ No newline at end of file
diff --git a/test/transform/resource/before/JacksonJsonProperty.java b/test/transform/resource/before/JacksonJsonProperty.java
index f002dc48..f0b7b2f2 100644
--- a/test/transform/resource/before/JacksonJsonProperty.java
+++ b/test/transform/resource/before/JacksonJsonProperty.java
@@ -1,10 +1,13 @@
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
import lombok.Builder;
import lombok.Setter;
@Builder
public class JacksonJsonProperty {
@JsonProperty("kebab-case-prop")
+ @JsonSetter(nulls = Nulls.SKIP)
@Setter
public String kebabCaseProp;
}