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 similar to {@code javax.xml.bind.annotation.XmlRootElement}, 10 * used to indicate name to use for root-level wrapping, if wrapping is 11 * enabled. Annotation itself does not indicate that wrapping should 12 * be used; but if it is, name used for serialization should be name 13 * specified here, and deserializer will expect the name as well. 14 */ 15 @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE}) 16 @Retention(RetentionPolicy.RUNTIME) 17 @com.fasterxml.jackson.annotation.JacksonAnnotation 18 public @interface JsonRootName 19 { 20 /** 21 * Root name to use if root-level wrapping is enabled. For data formats 22 * that use composite names (XML), this is the "local part" of the name 23 * to use. 24 */ value()25 public String value(); 26 27 /** 28 * Optional namespace to use with data formats that support such 29 * concept (specifically XML); if so, used with {@link #value} to 30 * construct fully-qualified name. 31 * 32 * @since 2.4 33 */ namespace()34 public String namespace() default ""; 35 36 /* 37 * Optional marker property that can be defined as <code>true</code> to force 38 * wrapping of root element, regardless of whether globally 39 * "root wrapping" is enabled or not. 40 *<p> 41 * Note that value of <code>false</code> is taken to mean "use defaults", 42 * and will not block use of wrapper if use is indicated by global features. 43 * 44 * @since 2.4 45 public boolean alwaysWrap() default false; 46 */ 47 } 48