author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Fri, 12 Apr 2013 15:59:24 +0200 | |
branch | fx |
changeset 973 | 44cd2b184dd1 |
parent 772 | d382dacfd73f |
child 1787 | ea12a3bb4b33 |
permissions | -rw-r--r-- |
jaroslav@106 | 1 |
/** |
jaroslav@106 | 2 |
* Back 2 Browser Bytecode Translator |
jaroslav@106 | 3 |
* Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
jaroslav@106 | 4 |
* |
jaroslav@106 | 5 |
* This program is free software: you can redistribute it and/or modify |
jaroslav@106 | 6 |
* it under the terms of the GNU General Public License as published by |
jaroslav@106 | 7 |
* the Free Software Foundation, version 2 of the License. |
jaroslav@106 | 8 |
* |
jaroslav@106 | 9 |
* This program is distributed in the hope that it will be useful, |
jaroslav@106 | 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
jaroslav@106 | 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
jaroslav@106 | 12 |
* GNU General Public License for more details. |
jaroslav@106 | 13 |
* |
jaroslav@106 | 14 |
* You should have received a copy of the GNU General Public License |
jaroslav@106 | 15 |
* along with this program. Look for COPYING file in the top folder. |
jaroslav@106 | 16 |
* If not, see http://opensource.org/licenses/GPL-2.0. |
jaroslav@94 | 17 |
*/ |
jaroslav@94 | 18 |
package org.apidesign.bck2brwsr.core; |
jaroslav@94 | 19 |
|
jaroslav@94 | 20 |
import java.lang.annotation.ElementType; |
jaroslav@94 | 21 |
import java.lang.annotation.Retention; |
jaroslav@94 | 22 |
import java.lang.annotation.RetentionPolicy; |
jaroslav@94 | 23 |
import java.lang.annotation.Target; |
jaroslav@94 | 24 |
|
jaroslav@793 | 25 |
/** Put this annotation on a method to provide its special implementation |
jaroslav@793 | 26 |
* in JavaScript. This is a way to define <em>native</em> methods that |
jaroslav@793 | 27 |
* interact with the surrounding environment. |
jaroslav@94 | 28 |
* |
jaroslav@94 | 29 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jaroslav@94 | 30 |
*/ |
jaroslav@94 | 31 |
@Retention(RetentionPolicy.CLASS) |
jaroslav@94 | 32 |
@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR }) |
jaroslav@94 | 33 |
public @interface JavaScriptBody { |
jaroslav@793 | 34 |
/** Names of parameters for the method generated method that can |
jaroslav@793 | 35 |
* be referenced from {@link #body()}. |
jaroslav@94 | 36 |
* |
jaroslav@94 | 37 |
* @return array of the names of parameters for the method |
jaroslav@94 | 38 |
* in JavaScript |
jaroslav@94 | 39 |
*/ |
jaroslav@94 | 40 |
public String[] args(); |
jaroslav@94 | 41 |
|
jaroslav@94 | 42 |
/** The actual body of the method in JavaScript. This string will be |
jaroslav@94 | 43 |
* put into generated header (ends with '{') and footer (ends with '}'). |
jaroslav@793 | 44 |
* The body can reference provided arguments. In case of non-static |
jaroslav@793 | 45 |
* instance method it may reference <code>this</code>. It can also |
jaroslav@793 | 46 |
* call methods and access fields - if |
jaroslav@793 | 47 |
* <a href="http://wiki.apidesign.org/wiki/Bck2BrwsrMangling">proper mangling</a> |
jaroslav@793 | 48 |
* is used. Methods that return some value should end with <code>return</code> |
jaroslav@793 | 49 |
* statement. |
jaroslav@94 | 50 |
*/ |
jaroslav@94 | 51 |
public String body(); |
jaroslav@94 | 52 |
} |