
net.java.html.js.JavaScriptBody Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of net.java.html.boot Show documentation
Show all versions of net.java.html.boot Show documentation
Builder to launch your Java/HTML based application.
The newest version!
/**
* HTML via Java(tm) Language Bindings
* Copyright (C) 2013 Jaroslav Tulach
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. apidesign.org
* designates this particular file as subject to the
* "Classpath" exception as provided by apidesign.org
* in the License file that accompanied this code.
*
* You should have received a copy of the GNU General Public License
* along with this program. Look for COPYING file in the top folder.
* If not, see http://wiki.apidesign.org/wiki/GPLwithClassPathException
*/
package net.java.html.js;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/** Put this annotation on a method to provide its special implementation
* in JavaScript. This is a way to define native methods that
* interact with the surrounding environment.
*
* @author Jaroslav Tulach
*/
@Retention(RetentionPolicy.CLASS)
@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR })
public @interface JavaScriptBody {
/** Names of parameters for the method generated method that can
* be referenced from {@link #body()}.
*
* @return array of the names of parameters for the method
* in JavaScript
*/
public String[] args();
/** The actual body of the method in JavaScript. This string will be
* put into generated header (last character is '{') and footer (e.g. '}').
* The body can reference provided arguments. In case of non-static
* instance method it may reference this
.
*
* @return JavaScript body of a function which can access {@link #args()} and possibly
* this
*/
public String body();
/** Should a special syntax for calling back into Java object be turned on?
* The syntax begins with {@code @} followed by fully qualified
* package name of the class. Now followed by :: and a method in
* the class followed by its parameters enclosed inside (...).
* This is the syntax one can use to call run()
* method of {@link Runnable}:
* [email protected]::run()()
.
* One can also call static methods. Just use:
* var ten = @java.lang.Integer::parseInt(Ljava/lang/String;)("10")
*
* @return true, if the script should be scanned for special callback
* syntax
*/
public boolean javacall() default false;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy