Subversion Repositories bacoAlunos

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1878 jmachado 1
package com.owlike.genson.annotation;
2
 
3
import java.lang.annotation.Documented;
4
import java.lang.annotation.ElementType;
5
import java.lang.annotation.Inherited;
6
import java.lang.annotation.Retention;
7
import java.lang.annotation.RetentionPolicy;
8
import java.lang.annotation.Target;
9
 
10
/**
11
 * JsonProperty annotation can be used to define the name of a property. You can apply it on fields
12
 * and methods. In that case this name will be used instead of the conventional one computed from
13
 * the signature. You can also use this annotation on parameters of creator methods and on
14
 * constructor parameters. In that case Genson during deserialization will try to use those names to
15
 * match the properties from the json stream. By default it is used in
16
 * {@link com.owlike.genson.reflect.PropertyNameResolver.AnnotationPropertyNameResolver
17
 * AnnotationPropertyNameResolver}.
18
 *
19
 * @author eugen
20
 * @see com.owlike.genson.reflect.PropertyNameResolver.AnnotationPropertyNameResolver
21
 * AnnotationPropertyNameResolver
22
 * @see com.owlike.genson.annotation.JsonCreator JsonCreator
23
 * @see com.owlike.genson.annotation.JsonIgnore JsonIgnore
24
 */
25
@1.5.0/docs/api/java/lang/annotation/Target.html">Target({1.5.0/docs/api/java/lang/annotation/ElementType.html">ElementType.METHOD, 1.5.0/docs/api/java/lang/annotation/ElementType.html">ElementType.PARAMETER, 1.5.0/docs/api/java/lang/annotation/ElementType.html">ElementType.FIELD})
26
@1.5.0/docs/api/java/lang/annotation/Retention.html">Retention(1.5.0/docs/api/java/lang/annotation/RetentionPolicy.html">RetentionPolicy.RUNTIME)
27
@1.5.0/docs/api/java/lang/annotation/Inherited.html">Inherited
28
@1.5.0/docs/api/java/lang/annotation/Documented.html">Documented
29
public @interface JsonProperty {
30
  /**
31
   * The name of that property.
32
   */
33
  1.5.0/docs/api/java/lang/String.html">String value() default "";
34
 
35
  /**
36
   * A list of aliases to use during deserialization for this property. Note that during serialization this is not used.
37
   */
38
  1.5.0/docs/api/java/lang/String.html">String[] aliases() default {};
39
 
40
  /**
41
   * Whether this property must be serialized. Default is true, the property will be serialized.
42
   */
43
  boolean serialize() default true;
44
 
45
  /**
46
   * Whether this property must be deserialized. Default is true, the property will be
47
   * deserialized.
48
   */
49
  boolean deserialize() default true;
50
}