MCPcopy Create free account
hub / github.com/akeranen/the-one / addProperty

Method addProperty

core/Message.java:284–292  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 9

handleMethod · 0.95
updateMethod · 0.95
testGetPropertyMethod · 0.45
testUpdatePropertyMethod · 0.45
testSubscribeMethod · 0.45
testUpdateDoubleMethod · 0.45
testAddPropertyMethod · 0.45
createNewMessageMethod · 0.45
updateMethod · 0.45

Calls 1

updatePropertyMethod · 0.95

Tested by 5

testGetPropertyMethod · 0.36
testUpdatePropertyMethod · 0.36
testSubscribeMethod · 0.36
testUpdateDoubleMethod · 0.36
testAddPropertyMethod · 0.36