1 21 22 package org.apache.derby.iapi.util; 23 24 import java.util.Properties ; 25 import java.util.Enumeration ; 26 27 37 38 public final class DoubleProperties extends Properties { 39 40 private final Properties read; 41 private final Properties write; 42 43 public DoubleProperties(Properties read, Properties write) { 44 this.read = read; 45 this.write = write; 46 } 47 48 public Object put(Object key, Object value) { 49 return write.put(key, value); 50 } 51 52 public String getProperty(String key) { 53 54 return read.getProperty(key, write.getProperty(key)); 55 } 56 57 public String getProperty(String key, String defaultValue) { 58 return read.getProperty(key, write.getProperty(key, defaultValue)); 59 60 } 61 62 public Enumeration propertyNames() { 63 64 Properties p = new Properties (); 65 66 if (write != null) { 67 68 for (Enumeration e = write.propertyNames(); e.hasMoreElements(); ) { 69 String key = (String ) e.nextElement(); 70 p.put(key, write.getProperty(key)); 71 } 72 } 73 74 if (read != null) { 75 for (Enumeration e = read.propertyNames(); e.hasMoreElements(); ) { 76 String key = (String ) e.nextElement(); 77 p.put(key, read.getProperty(key)); 78 } 79 } 80 return p.keys(); 81 } 82 } 83 | Popular Tags |