1 package de.java2html.util; 2 3 import java.util.Collection ; 4 import java.util.Enumeration ; 5 import java.util.LinkedHashMap ; 6 import java.util.Map ; 7 import java.util.Properties ; 8 import java.util.Set ; 9 10 15 public class LinkedProperties extends Properties { 16 private LinkedHashMap map = new LinkedHashMap (); 17 18 public synchronized Object put(Object key, Object value) { 19 return map.put(key, value); 20 } 21 22 public synchronized Object get(Object key) { 23 return map.get(key); 24 } 25 26 public synchronized void clear() { 27 map.clear(); 28 } 29 30 public synchronized Object clone() { 31 throw new UnsupportedOperationException (); 32 } 33 34 public boolean containsValue(Object value) { 35 return map.containsValue(value); 36 } 37 38 public synchronized boolean contains(Object value) { 39 return containsValue(value); 40 } 41 42 public synchronized boolean containsKey(Object key) { 43 return map.containsKey(key); 44 } 45 46 public synchronized Enumeration elements() { 47 return new IteratorEnumeration(map.values().iterator()); 48 } 49 50 public Set entrySet() { 51 return map.entrySet(); 52 } 53 54 public synchronized boolean equals(Object o) { 55 throw new UnsupportedOperationException (); 56 } 57 58 public synchronized boolean isEmpty() { 59 return map.isEmpty(); 60 } 61 62 public synchronized Enumeration keys() { 63 return new IteratorEnumeration(map.keySet().iterator()); 64 } 65 66 public Set keySet() { 67 return map.keySet(); 68 } 69 70 public Enumeration propertyNames() { 71 throw new UnsupportedOperationException (); 72 } 73 74 public synchronized void putAll(Map t) { 75 map.putAll(t); 76 } 77 public synchronized Object remove(Object key) { 78 return map.remove(key); 79 } 80 81 public synchronized int size() { 82 return map.size(); 83 } 84 85 public Collection values() { 86 throw new UnsupportedOperationException (); 87 } 88 89 public String getProperty(String key) { 90 Object oval = get(key); 91 String sval = (oval instanceof String ) ? (String )oval : null; 92 return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval; 93 } 94 } | Popular Tags |