| 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 | // API class |
| 8 | |
| 9 | package org.mozilla.javascript; |
| 10 | |
| 11 | /** |
| 12 | * Interface to define classes from generated byte code. |
| 13 | */ |
| 14 | public interface GeneratedClassLoader { |
| 15 | |
| 16 | /** |
| 17 | * Define a new Java class. |
| 18 | * Classes created via this method should have the same class loader. |
| 19 | * |
| 20 | * @param name fully qualified class name |
| 21 | * @param data class byte code |
| 22 | * @return new class object |
| 23 | */ |
| 24 | public Class<?> defineClass(String name, byte[] data); |
| 25 | |
| 26 | /** |
| 27 | * Link the given class. |
| 28 | * |
| 29 | * @param cl Class instance returned from the previous call to |
| 30 | * {@link #defineClass(String, byte[])} |
| 31 | * @see java.lang.ClassLoader |
| 32 | */ |
| 33 | public void linkClass(Class<?> cl); |
| 34 | } |