1 10 11 package org.mule.providers.dq; 12 13 import java.io.Serializable ; 14 import java.util.ArrayList ; 15 import java.util.HashMap ; 16 import java.util.Iterator ; 17 import java.util.LinkedHashMap ; 18 import java.util.List ; 19 import java.util.Map ; 20 21 24 public class DQMessage implements Serializable 25 { 26 29 private static final long serialVersionUID = 5819476148531491540L; 30 31 public static final String XML_ROOT = "DQMessage"; 32 public static final String XML_ENTRY = "entry"; 33 public static final String XML_NAME = "name"; 34 35 private Map entries = new HashMap (); 36 private String senderInformation; 37 38 41 public final String getSenderInformation() 42 { 43 return senderInformation; 44 } 45 46 49 public final void setSenderInformation(final String pSenderInformation) 50 { 51 senderInformation = pSenderInformation; 52 } 53 54 57 public DQMessage() 58 { 59 super(); 60 } 61 62 67 public DQMessage(final DQMessage pMessage) 68 { 69 this(); 70 if (pMessage == null) 71 { 72 return; 73 } 74 this.entries = new LinkedHashMap (pMessage.entries); 75 this.senderInformation = pMessage.senderInformation; 76 } 77 78 84 public final void addEntry(final String name, final Object value) 85 { 86 entries.put(name, value); 87 } 88 89 95 public final Object getEntry(final String name) 96 { 97 return entries.get(name); 98 } 99 100 103 public final Iterator getEntries() 104 { 105 return entries.values().iterator(); 106 } 107 108 111 public final List getEntryNames() 112 { 113 ArrayList list = new ArrayList (); 114 115 Iterator it = entries.keySet().iterator(); 116 117 while (it.hasNext()) 118 { 119 list.add(it.next()); 120 } 121 122 return list; 123 } 124 125 public boolean equals(Object o) 126 { 127 if (this == o) 128 { 129 return true; 130 } 131 if (!(o instanceof DQMessage)) 132 { 133 return false; 134 } 135 final DQMessage dqMessage = (DQMessage)o; 136 if (entries != null ? !entries.equals(dqMessage.entries) : dqMessage.entries != null) 137 { 138 return false; 139 } 140 if (senderInformation != null 141 ? !senderInformation.equals(dqMessage.senderInformation) 142 : dqMessage.senderInformation != null) 143 { 144 return false; 145 } 146 return true; 147 } 148 149 public int hashCode() 150 { 151 int result; 152 result = (entries != null ? entries.hashCode() : 0); 153 result = 29 * result + (senderInformation != null ? senderInformation.hashCode() : 0); 154 return result; 155 } 156 } 157 | Popular Tags |