diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonApplyView.java b/src/main/java/com/fasterxml/jackson/annotation/JsonApplyView.java new file mode 100644 index 00000000..2a96ba8e --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/annotation/JsonApplyView.java @@ -0,0 +1,34 @@ +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; + +/** + * Annotation used for specifying view that should be used to + * process (serialize) the property that is defined by method + * or field annotated. + *
+ * An example annotation would be: + *
+ * @JsonApplyView(BasicView.class) + *+ * which would specify that property annotated would be processed + * (serialized) using View identified by
BasicView.class.
+ */
+@Target({ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@JacksonAnnotation
+public @interface JsonApplyView {
+ /**
+ * View that should be used to serialize annotated property.
+ */
+ public Class> value() default NONE.class;
+
+ /**
+ * Special view indicating no views should be used to serialize annotated property.
+ */
+ static public interface NONE {}
+}