| 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 | * Implement this interface in order to allow external data to be attached to a ScriptableObject. |
| 11 | */ |
| 12 | |
| 13 | public interface ExternalArrayData |
| 14 | { |
| 15 | /** |
| 16 | * Return the element at the specified index. The result must be a type that is valid in JavaScript: |
| 17 | * Number, String, or Scriptable. This method will not be called unless "index" is in |
| 18 | * range. |
| 19 | */ |
| 20 | Object getArrayElement(int index); |
| 21 | |
| 22 | /** |
| 23 | * Set the element at the specified index. This method will not be called unless "index" is in |
| 24 | * range. The method must check that "value" is a valid type, and convert it if necessary. |
| 25 | */ |
| 26 | void setArrayElement(int index, Object value); |
| 27 | |
| 28 | /** |
| 29 | * Return the length of the array. |
| 30 | */ |
| 31 | int getArrayLength(); |
| 32 | } |