Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/DynamicObject.java @ 21652:5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 12:55:56 +0200 |
parents | 723142fed324 |
children |
comparison
equal
deleted
inserted
replaced
21651:f4cd6b1c2efc | 21652:5f3dda39d205 |
---|---|
48 * @param key property identifier | 48 * @param key property identifier |
49 * @param value value to be set | 49 * @param value value to be set |
50 * @return {@code true} if successful or {@code false} if property not found | 50 * @return {@code true} if successful or {@code false} if property not found |
51 */ | 51 */ |
52 public abstract boolean set(Object key, Object value); | 52 public abstract boolean set(Object key, Object value); |
53 | |
54 /** | |
55 * Returns {@code true} if this object contains a property with the given key. | |
56 */ | |
57 public final boolean containsKey(Object key) { | |
58 return getShape().getProperty(key) != null; | |
59 } | |
60 | |
61 /** | |
62 * Define new property or redefine existing property. | |
63 * | |
64 * @param key property identifier | |
65 * @param value value to be set | |
66 */ | |
67 public final void define(Object key, Object value) { | |
68 define(key, value, 0); | |
69 } | |
53 | 70 |
54 /** | 71 /** |
55 * Define new property or redefine existing property. | 72 * Define new property or redefine existing property. |
56 * | 73 * |
57 * @param key property identifier | 74 * @param key property identifier |