| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; | |
| 4 | 4 | import com.fasterxml.jackson.databind.introspect.Annotated; | |
| 5 | + import com.fasterxml.jackson.databind.introspect.AnnotatedClass; | ||
| 5 | 6 | import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; | |
| 6 | 7 | ||
| 7 | 8 | import static com.fasterxml.jackson.annotation.JsonFormat.Shape.ARRAY; | |
@@ -17,6 +18,10 @@ public class JsonArrayFormat extends JacksonAnnotationIntrospector | |||
| 17 | 18 | { | |
| 18 | 19 | private static final JsonFormat.Value ARRAY_FORMAT = new JsonFormat.Value().withShape(ARRAY); | |
| 19 | 20 | ||
| 21 | + /** | ||
| 22 | + * Defines array format for serialized entities with ObjectMapper, without actually | ||
| 23 | + * including the schema | ||
| 24 | + */ | ||
| 20 | 25 | @Override | |
| 21 | 26 | public JsonFormat.Value findFormat(Annotated ann) | |
| 22 | 27 | { | |
@@ -28,4 +33,21 @@ public JsonFormat.Value findFormat(Annotated ann) | |||
| 28 | 33 | ||
| 29 | 34 | return ARRAY_FORMAT; | |
| 30 | 35 | } | |
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Defines that unknown properties will be ignored, and won't fail the un-marshalling process. | ||
| 39 | + * Happens in case of de-serialization of a payload that contains more properties than the actual | ||
| 40 | + * value type | ||
| 41 | + */ | ||
| 42 | + @Override | ||
| 43 | + public Boolean findIgnoreUnknownProperties(AnnotatedClass ac) | ||
| 44 | + { | ||
| 45 | + // If the entity contains JsonIgnoreProperties annotation, give it higher priority. | ||
| 46 | + final Boolean precedenceIgnoreUnknownProperties = super.findIgnoreUnknownProperties(ac); | ||
| 47 | + if (precedenceIgnoreUnknownProperties != null) { | ||
| 48 | + return precedenceIgnoreUnknownProperties; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + return true; | ||
| 52 | + } | ||
| 31 | 53 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments