From 72d2fcb59e404cfa1dd995d18f766cf0f68b7ba8 Mon Sep 17 00:00:00 2001 From: Robin Bygrave Date: Sun, 19 Jul 2015 21:37:37 +1200 Subject: [PATCH] #330 - JSON - Add ebean @JsonIgnore ... with serialize() default false and deserialize() default false --- .../avaje/ebean/annotation/JsonIgnore.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main/java/com/avaje/ebean/annotation/JsonIgnore.java diff --git a/src/main/java/com/avaje/ebean/annotation/JsonIgnore.java b/src/main/java/com/avaje/ebean/annotation/JsonIgnore.java new file mode 100644 index 000000000..79635ddc1 --- /dev/null +++ b/src/main/java/com/avaje/ebean/annotation/JsonIgnore.java @@ -0,0 +1,32 @@ +package com.avaje.ebean.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Similar to Jackson JsonIgnore but provides the option to just ignore serialize or deserialize. + *

+ * This provides the same features as Expose but from the opposite perspective which is probably + * more common and more familiar to Jackson users. + *

+ */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface JsonIgnore { + + /** + * If {@code true}, the field marked with this annotation is written out in the JSON while + * serializing. If {@code false}, the field marked with this annotation is skipped from the + * serialized output. Defaults to {@code false}. + */ + boolean serialize() default false; + + /** + * If {@code true}, the field marked with this annotation is deserialized from the JSON. + * If {@code false}, the field marked with this annotation is skipped during deserialization. + * Defaults to {@code false}. + */ + boolean deserialize() default false; +} \ No newline at end of file