Coverage Report - no.sesat.mojo.modes.ConfigAttribute
 
Classes in this File Line Coverage Branch Coverage Complexity
ConfigAttribute
0%
0/24
0%
0/4
1.8
 
 1  
 package no.sesat.mojo.modes;
 2  
 
 3  
 import com.sun.javadoc.MethodDoc;
 4  
 
 5  
 /**
 6  
  * Data representing an attribute.
 7  
  *
 8  
  */
 9  
 public class ConfigAttribute extends ConfigAbstract {
 10  
 
 11  0
     protected String type = "CDATA";
 12  0
     protected boolean required = false;
 13  
 
 14  
     /**
 15  
      * @param method Construct this attribute from a Javadoc element.
 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"; // method.parameters()[0].toString();
 22  0
     }
 23  
 
 24  
     /**
 25  
      * @param name
 26  
      *            Name of this attribute.
 27  
      */
 28  0
     protected ConfigAttribute(final String name) {
 29  0
         this.name = name;
 30  0
     }
 31  
 
 32  
     /**
 33  
      * @param name
 34  
      *            Name of this attribute.
 35  
      * @param doc
 36  
      *            Doc for this attribute.
 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  
      * @param name
 45  
      *            Name of this attribute.
 46  
      * @param doc
 47  
      *            Doc for this attribute.
 48  
      * @param required
 49  
      *            if this is required attribute or not
 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  
 }