1 28 package net.sf.jasperreports.engine; 29 30 import java.io.Serializable ; 31 import java.util.Map ; 32 import java.util.Set ; 33 34 import org.apache.commons.collections.SequencedHashMap; 35 36 45 public class JRPropertiesMap implements Serializable 46 { 47 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 48 49 private final Map propertiesMap; 50 51 52 55 public JRPropertiesMap() 56 { 57 propertiesMap = new SequencedHashMap(); 58 } 59 60 61 66 public JRPropertiesMap(JRPropertiesMap propertiesMap) 67 { 68 this.propertiesMap = new SequencedHashMap(); 69 70 String [] propertyNames = propertiesMap.getPropertyNames(); 71 if (propertyNames != null && propertyNames.length > 0) 72 { 73 for(int i = 0; i < propertyNames.length; i++) 74 { 75 setProperty(propertyNames[i], propertiesMap.getProperty(propertyNames[i])); 76 } 77 } 78 } 79 80 81 86 public String [] getPropertyNames() 87 { 88 Set names = propertiesMap.keySet(); 89 String [] namesArray = new String [names.size()]; 90 return (String []) names.toArray(namesArray); 91 } 92 93 94 100 public String getProperty(String propName) 101 { 102 return (String )propertiesMap.get(propName); 103 } 104 105 106 112 public void setProperty(String propName, String value) 113 { 114 propertiesMap.put(propName, value); 115 } 116 117 118 123 public void removeProperty(String propName) 124 { 125 propertiesMap.remove(propName); 126 } 127 } 128 | Popular Tags |