1 42 43 package org.jfree.util; 44 45 import java.util.Collections ; 46 import java.util.Enumeration ; 47 import java.util.Iterator ; 48 import java.util.Properties ; 49 import java.util.TreeSet ; 50 51 import org.jfree.base.config.ModifiableConfiguration; 52 53 58 public class DefaultConfiguration extends Properties  59 implements ModifiableConfiguration 60 { 61 62 65 public DefaultConfiguration() 66 { 67 super(); 68 } 69 70 76 public String getConfigProperty(final String key) 77 { 78 return getProperty(key); 79 } 80 81 92 public String getConfigProperty(final String key, final String defaultValue) 93 { 94 return getProperty(key, defaultValue); 95 } 96 97 103 public Iterator findPropertyKeys(final String prefix) 104 { 105 final TreeSet collector = new TreeSet (); 106 final Enumeration enum1 = keys(); 107 while (enum1.hasMoreElements()) 108 { 109 final String key = (String ) enum1.nextElement(); 110 if (key.startsWith(prefix)) 111 { 112 if (collector.contains(key) == false) 113 { 114 collector.add(key); 115 } 116 } 117 } 118 return Collections.unmodifiableSet(collector).iterator(); 119 } 120 121 public Enumeration getConfigProperties() 122 { 123 return keys(); 124 } 125 126 132 public void setConfigProperty(final String key, final String value) 133 { 134 if (value == null) 135 { 136 remove(key); 137 } 138 else 139 { 140 setProperty(key, value); 141 } 142 } 143 } 144
| Popular Tags
|