Repository navigation
Expand file tree
/
Copy pathXmlAbstractClass.java
More file actions
53 lines (48 loc) · 1.57 KB
/
Copy pathXmlAbstractClass.java
File metadata and controls
53 lines (48 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package xmlparser.annotations;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Used for deserializing fields of abstract classes
*/
@Retention(RUNTIME)
public @interface XmlAbstractClass {
/**
* Pairs one value of the type marker with the class it stands for: what was read out of the
* marker attribute or tag, and the type to build from it.
*/
@interface TypeMap {
/**
* The marker value this pair stands for.
*
* @return the text that selects this type, as it appears in the attribute or tag
*/
String name();
/**
* The concrete class to build for this pair.
*
* @return the type to instantiate when the marker holds {@code name()}
*/
Class<?> type();
}
/**
* The name of the attribute holding the type marker.
*
* @return the attribute to read it from, unless {@code tag()} names a child element instead;
* it defaults to {@code "class"}
*/
String attribute() default "class";
/**
* The name of a child element holding the type marker.
*
* @return the child element to read it from instead of the attribute; the empty default means
* {@code attribute()} is used
*/
String tag() default "";
/**
* The pairs mapping a marker value to the class it stands for.
*
* @return every type this annotation can build; a marker matching none of them is an
* InvalidAnnotation
*/
TypeMap[] types();
}