xref: /aosp_15_r20/external/jackson-annotations/src/main/java/com/fasterxml/jackson/annotation/JsonRawValue.java (revision 2bf6642460ffb10303bd46207a4555f36d9e5945)
1 package com.fasterxml.jackson.annotation;
2 
3 import java.lang.annotation.ElementType;
4 import java.lang.annotation.Retention;
5 import java.lang.annotation.RetentionPolicy;
6 import java.lang.annotation.Target;
7 
8 /**
9  * Marker annotation that indicates that the annotated method
10  * or field should be serialized by including literal String value
11  * of the property as is, without quoting of characters.
12  * This can be useful for injecting values already serialized in JSON or
13  * passing javascript function definitions from server to a javascript client.
14  *<p>
15  * Warning: the resulting JSON stream may be invalid depending on your input value.
16  */
17 @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD })
18 @Retention(RetentionPolicy.RUNTIME)
19 @JacksonAnnotation
20 public @interface JsonRawValue
21 {
22     /**
23      * Optional argument that defines whether this annotation is active
24      * or not. The only use for value 'false' if for overriding purposes
25      * (which is not needed often); most likely it is needed for use
26      * with "mix-in annotations" (aka "annotation overrides").
27      * For most cases, however, default value of "true" is just fine
28      * and should be omitted.
29      */
value()30     boolean value() default true;
31 }
32