Adds a generic property for this message. The key can be any string but it should be such that no other class accidently uses the same value. The value can be any object but it's good idea to store only immutable objects because when message is replicated, only a shallow copy of the properties is ma
(String key, Object value)
| 282 | * @throws SimError if the message already has a value for the given key |
| 283 | */ |
| 284 | public void addProperty(String key, Object value) throws SimError { |
| 285 | if (this.properties != null && this.properties.containsKey(key)) { |
| 286 | /* check to prevent accidental name space collisions */ |
| 287 | throw new SimError("Message " + this + " already contains value " + |
| 288 | "for a key " + key); |
| 289 | } |
| 290 | |
| 291 | this.updateProperty(key, value); |
| 292 | } |
| 293 | |
| 294 | /** |
| 295 | * Returns an object that was stored to this message using the given |