Changeset 1988 for trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/eventcore/EqualSOAPDataMap.java
- Timestamp:
- 07/07/15 08:36:28 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/eventcore/EqualSOAPDataMap.java
r1986 r1988 15 15 package de.ugoe.cs.autoquest.plugin.http.eventcore; 16 16 17 import java.io.IOException;18 import java.io.ObjectInputStream;19 import java.io.ObjectOutputStream;20 17 import java.io.Serializable; 21 18 import java.util.Collections; … … 38 35 /** */ 39 36 private static final long serialVersionUID = 1L; 40 41 /**42 * Singleton. Handle to only instance of this class43 */44 transient private static EqualSOAPDataMap INSTANCE = new EqualSOAPDataMap();45 37 46 38 /** … … 52 44 * random number generator for picking a random request body 53 45 */ 54 transient private final Random random; 55 56 /** 57 * <p> 58 * return the instance of the class 59 * </p> 60 * 61 * @return 62 */ 63 public static EqualSOAPDataMap getInstance() { 64 return INSTANCE; 65 } 66 67 private EqualSOAPDataMap() { 68 // private constructor to avoid initialization 69 random = new Random(); 70 } 71 72 /** 73 * <p> 74 * Manual serialization of the object. Necessary to guarantee the singleton 75 * property. 76 * </p> 77 * 78 * @param s 79 * output stream for the serialization 80 * @throws IOException 81 * thrown if there is problem writing to the output stream 82 */ 83 private void writeObject(ObjectOutputStream s) throws IOException { 84 s.defaultWriteObject(); 85 s.writeObject(soapRequestBodies); 86 } 46 private final Random random = new Random(); 87 47 88 48 /** 89 49 * <p> 90 * Manual de-serialization of the object. Necessary to guarantee the 91 * singleton property. 92 * 93 * @param s 94 * input stream for the de-serialization 95 * @throws IOException 96 * thrown if there is problem reading from the input stream 97 * @throws ClassNotFoundException 98 * thrown if there is a problem reading from the input stream 50 * Default constructor. 51 * </p> 99 52 */ 100 @SuppressWarnings("unchecked") 101 private void readObject(ObjectInputStream s) throws IOException, 102 ClassNotFoundException { 103 s.defaultReadObject(); 104 if (INSTANCE == null) { 105 INSTANCE = new EqualSOAPDataMap(); 106 } 107 INSTANCE.soapRequestBodies = (Map<SimpleSOAPEventType, ListOrderedSet<String>>) s.readObject(); 53 public EqualSOAPDataMap() { 54 108 55 } 109 110 /** 111 * <p> 112 * Manual de-serialization to guarantee the singleton property. 113 * </p> 114 * 115 * @return instance of the container 116 */ 117 private Object readResolve() { 118 return INSTANCE; 119 } 120 56 121 57 /** 122 58 * <p> … … 175 111 soapRequestBodies = new HashMap<>(); 176 112 } 113 114 /** 115 * <p> 116 * returns is the current data map is empty 117 * </p> 118 * 119 * @return true if empty; false otherwise 120 */ 121 public boolean isEmpty() { 122 return soapRequestBodies.isEmpty(); 123 } 177 124 }
Note: See TracChangeset
for help on using the changeset viewer.