launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/fximpl/Fn.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 10 Jun 2013 18:19:40 +0200
branchclassloader
changeset 1171 9753524d698f
child 1181 b703d9d71f25
permissions -rw-r--r--
Separating the Fn class outside of the classloader and moving methods the generated code deals with into it
jaroslav@1171
     1
/**
jaroslav@1171
     2
 * Back 2 Browser Bytecode Translator
jaroslav@1171
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@1171
     4
 *
jaroslav@1171
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@1171
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@1171
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@1171
     8
 *
jaroslav@1171
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@1171
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@1171
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@1171
    12
 * GNU General Public License for more details.
jaroslav@1171
    13
 *
jaroslav@1171
    14
 * You should have received a copy of the GNU General Public License
jaroslav@1171
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@1171
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@1171
    17
 */
jaroslav@1171
    18
package org.apidesign.bck2brwsr.launcher.fximpl;
jaroslav@1171
    19
jaroslav@1171
    20
/**
jaroslav@1171
    21
 *
jaroslav@1171
    22
 * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@1171
    23
 */
jaroslav@1171
    24
public abstract class Fn {
jaroslav@1171
    25
    public static Fn define(Class<?> caller, String code, String... names) {
jaroslav@1171
    26
        JsClassLoader cl = (JsClassLoader)caller.getClassLoader();
jaroslav@1171
    27
        return cl.defineFn(code, names);
jaroslav@1171
    28
    }
jaroslav@1171
    29
jaroslav@1171
    30
    public abstract Object invoke(Object... args) throws Exception;
jaroslav@1171
    31
    
jaroslav@1171
    32
}