1
2
3
4
5
6
7
8
9
10
11 package org.mule.message;
12
13 import org.mule.transport.NullPayload;
14
15 import java.io.Serializable;
16 import java.util.HashMap;
17 import java.util.Map;
18
19
20
21
22
23 public class BaseMessageDTO implements Serializable
24 {
25
26
27
28 private static final long serialVersionUID = -6105691921086093748L;
29
30 private Object payload;
31
32 protected Map<String, Object> properties;
33
34 public BaseMessageDTO()
35 {
36 this(NullPayload.getInstance());
37 }
38
39 public BaseMessageDTO(Object payload)
40 {
41 this.payload = payload;
42 properties = new HashMap<String, Object>();
43 }
44
45
46 public void setPayload(Object payload)
47 {
48 this.payload = payload;
49 }
50
51
52
53
54 public Object getPayload()
55 {
56 return payload;
57 }
58
59
60
61
62
63
64
65 public void addProperties(Map<String, Object> properties)
66 {
67 this.properties.putAll(properties);
68 }
69
70
71
72
73 public void clearProperties()
74 {
75 properties.clear();
76 }
77
78
79
80
81
82
83 public Map getProperties()
84 {
85 return properties;
86 }
87
88 public void setProperty(String key, Object value)
89 {
90 properties.put(key, value);
91 }
92
93 public Object getProperty(String key)
94 {
95 return properties.get(key);
96 }
97
98 public String toString()
99 {
100 return "BaseMessageDTO{" + "payload=" + payload + ", properties=" + properties + "}";
101 }
102 }