Coverage Report - org.naftulin.configmgr.content.XmlRecordImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
XmlRecordImpl
75%
9/12
N/A
1
 
 1  
 package org.naftulin.configmgr.content;
 2  
 
 3  
 import org.naftulin.configmgr.parsers.ConfigEntryParser;
 4  
 import org.naftulin.configmgr.parsers.XmlFileParserImpl;
 5  
 import org.apache.commons.lang.builder.ToStringBuilder;
 6  
 
 7  
 
 8  
 public class XmlRecordImpl extends AbstractRecordImpl {
 9  
         private String className;
 10  
 
 11  
         /**
 12  
          * Constructs a record without specifying the key or file name.
 13  
          */
 14  
         public XmlRecordImpl() {
 15  10
                 super();
 16  10
         }
 17  
 
 18  
         /**
 19  
          * Constructs a record with the key and file name specified.
 20  
          * @param key the key associated with the record.
 21  
          * @param fileName the file name associated with the record.
 22  
          */
 23  
         public XmlRecordImpl(final String key, final String fileName, final String className) {
 24  0
                 super(key, fileName);
 25  0
                 this.className = className;
 26  0
         }
 27  
 
 28  
         /**
 29  
          * Returns an instance of  {@link org.naftulin.configmgr.parsers.PropertyFileParserImpl parser} 
 30  
          * that parses a property file and stores it as {@link java.util.Properties properties}.
 31  
          * @return the parser that can parse the file to extract the configuration. 
 32  
          */
 33  
         public ConfigEntryParser getParser() {
 34  5
                 return new XmlFileParserImpl(className);
 35  
         }
 36  
 
 37  
         
 38  
         public String getClassName() {
 39  5
                 return className;
 40  
         }
 41  
 
 42  
         public void setClassName(final String className) {
 43  10
                 this.className = className;
 44  10
         }
 45  
 
 46  
         /**
 47  
          * Returns the string representation of the xml record.
 48  
          * @return the string representation of the xml record.
 49  
          */
 50  
         public String toString() {
 51  15
                 return new ToStringBuilder(this).append("key", this.getKey()).append(
 52  15
                                 "parser", this.getParser()).append("fileName",
 53  10
                                 this.getFileName()).toString();
 54  
         }
 55  
         
 56  
         
 57  
         
 58  
 }