| 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 | 0 | protected String type = "CDATA"; |
| 12 | 0 | protected boolean required = false; |
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | 0 | public ConfigAttribute(final MethodDoc method) { |
| 18 | 0 | doc = parseDoc(method); |
| 19 | |
|
| 20 | 0 | name = Builder.toXmlName(method.name()).substring(4); |
| 21 | 0 | type = "CDATA"; |
| 22 | 0 | } |
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | 0 | protected ConfigAttribute(final String name) { |
| 29 | 0 | this.name = name; |
| 30 | 0 | } |
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | 0 | protected ConfigAttribute(final String name, final String doc) { |
| 39 | 0 | this.name = name; |
| 40 | 0 | this.doc = doc; |
| 41 | 0 | } |
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | 0 | protected ConfigAttribute(final String name, final String doc, final boolean required) { |
| 52 | 0 | this.name = name; |
| 53 | 0 | this.doc = doc; |
| 54 | 0 | this.required = required; |
| 55 | 0 | } |
| 56 | |
|
| 57 | |
private String parseDoc(final MethodDoc method) { |
| 58 | 0 | if (method == null) { |
| 59 | 0 | return null; |
| 60 | |
} |
| 61 | 0 | if (method.commentText().contains("{@inheritDoc}")) { |
| 62 | 0 | return parseDoc(method.overriddenMethod()); |
| 63 | |
} else { |
| 64 | 0 | return method.commentText(); |
| 65 | |
} |
| 66 | |
} |
| 67 | |
} |