Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/main/java/com/fasterxml/jackson/annotation/JsonApplyView.java
Original file line number Diff line number Diff line change
@@ -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.
*<p>
* An example annotation would be:
*<pre>
* &#064;JsonApplyView(BasicView.class)
*</pre>
* which would specify that property annotated would be processed
* (serialized) using View identified by <code>BasicView.class</code>.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add

@SInCE 2.22

to indicate inclusion in the next version of jackson-annotations

*/
@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 {}
}