1 19 package jcckit.util; 20 21 import java.io.*; 22 import java.util.Properties ; 23 24 30 public class PropertiesBasedConfigData extends FlatConfigData { 31 private final Properties _properties; 32 33 40 public PropertiesBasedConfigData(String fileName) throws IOException { 41 super(null); 42 _properties = new Properties (); 43 _properties.load(new FileInputStream(fileName)); 44 } 45 46 50 public PropertiesBasedConfigData(Properties properties) { 51 this(properties, null); 52 } 53 54 55 private PropertiesBasedConfigData(Properties properties, String path) { 56 super(path); 57 _properties = properties; 58 } 59 60 66 protected String getValue(String fullKey) { 67 return _properties.getProperty(fullKey); 68 } 69 70 77 protected ConfigData createConfigData(String path) { 78 return new PropertiesBasedConfigData(_properties, path); 79 } 80 } 81 | Popular Tags |