| 1 | /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
| 2 | * |
| 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 6 | |
| 7 | package org.mozilla.javascript; |
| 8 | |
| 9 | /** |
| 10 | * This interface may be combined with any object that implements Scriptable |
| 11 | * to add support for properties keyed by Symbol objects (as opposed to |
| 12 | * String and number objects as in previous versions of JavaScript. |
| 13 | * It's separated into its own interface so that the addition of Symbol |
| 14 | * support does not break compatibility for existing code. |
| 15 | * |
| 16 | * @since 1.7.8 |
| 17 | */ |
| 18 | |
| 19 | public interface SymbolScriptable |
| 20 | { |
| 21 | /** |
| 22 | * Return the value of the property with the specified key, or |
| 23 | * NOT_FOUND. |
| 24 | */ |
| 25 | Object get(Symbol key, Scriptable start); |
| 26 | |
| 27 | /** |
| 28 | * Return true if the specified property exists. |
| 29 | */ |
| 30 | boolean has(Symbol key, Scriptable start); |
| 31 | |
| 32 | /** |
| 33 | * Add a new property to to the object. |
| 34 | */ |
| 35 | void put(Symbol key, Scriptable start, Object value); |
| 36 | |
| 37 | /** |
| 38 | * Delete a property with the specified key. |
| 39 | */ |
| 40 | void delete(Symbol key); |
| 41 | } |