1 package no.sesat.mojo.modes;
2
3 import com.sun.javadoc.MethodDoc;
4
5
6
7
8
9 public class ConfigAttribute extends ConfigAbstract {
10
11 protected String type = "CDATA";
12 protected boolean required = false;
13
14
15
16
17 public ConfigAttribute(final MethodDoc method) {
18 doc = parseDoc(method);
19
20 name = Builder.toXmlName(method.name()).substring(4);
21 type = "CDATA";
22 }
23
24
25
26
27
28 protected ConfigAttribute(final String name) {
29 this.name = name;
30 }
31
32
33
34
35
36
37
38 protected ConfigAttribute(final String name, final String doc) {
39 this.name = name;
40 this.doc = doc;
41 }
42
43
44
45
46
47
48
49
50
51 protected ConfigAttribute(final String name, final String doc, final boolean required) {
52 this.name = name;
53 this.doc = doc;
54 this.required = required;
55 }
56
57 private String parseDoc(final MethodDoc method) {
58 if (method == null) {
59 return null;
60 }
61 if (method.commentText().contains("{@inheritDoc}")) {
62 return parseDoc(method.overriddenMethod());
63 } else {
64 return method.commentText();
65 }
66 }
67 }