1 package org.naftulin.configmgr.content; 2 3 import org.naftulin.configmgr.parsers.ConfigEntryParser; 4 import org.naftulin.configmgr.parsers.PropertyFileParserImpl; 5 import org.apache.commons.lang.builder.ToStringBuilder; 6 7 8 public class PropertyRecordImpl extends AbstractRecordImpl { 9 private static final ConfigEntryParser PARSER = new PropertyFileParserImpl(); 10 11 /*** 12 * Constructs a record without specifying the key or file name. 13 */ 14 public PropertyRecordImpl() { 15 super(); 16 } 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 PropertyRecordImpl(final String key, final String fileName) { 24 super(key, fileName); 25 } 26 27 /*** 28 * Returns an instance of {@link org.naftulin.configmgr.parsers.PropertyFileParserImpl parser} 29 * that parses a property file and stores it as {@link java.util.Properties properties}. 30 * @return the parser that can parse the file to extract the configuration. 31 */ 32 public ConfigEntryParser getParser() { 33 return PARSER; 34 } 35 36 /*** 37 * Returns the string representation of the property record. 38 * @return the string representation of the property record. 39 */ 40 public String toString() { 41 return new ToStringBuilder(this).append("key", this.getKey()).append( 42 "fileName", this.getFileName()).append("parser", 43 this.getParser()).toString(); 44 } 45 46 47 }