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  * Annotation that can be used to define one or more alternative names for
10  * a property, accepted during deserialization as alternative to the official
11  * name. Alias information is also exposed during POJO introspection, but has
12  * no effect during serialization where primary name is always used.
13  *<p>
14  * Examples:
15  *<pre>
16  *public class Info {
17  *  &#64;JsonAlias({ "n", "Name" })
18  *  public String name;
19  *}
20  *</pre>
21  *
22  * @since 2.9
23  */
24 @Target({ElementType.ANNOTATION_TYPE, // for combo-annotations
25     ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER// for properties (field, setter, ctor param)
26 })
27 @Retention(RetentionPolicy.RUNTIME)
28 @JacksonAnnotation
29 public @interface JsonAlias
30 {
31     /**
32      * One or more secondary names to accept as aliases to the official name.
33      *
34      * @return Zero or more aliases to associate with property annotated
35      */
value()36     public String[] value() default { };
37 }
38