Java Reference
In-Depth Information
var str = object
as
String;
println(str.toLowerCase());
}else {
println(object);
}
}
printLower("Rich Internet Application");
printLower(3.14);
For a pure script that does not declare exported classes, variables, or functions,
the command-line arguments can be retrieved using the
javafx.lang.FX
.getArguments():String[]
function. This returns a
Sequence
of
String
s that
contains the arguments passed to the script when it started. There is a another
version of this for use in other invocations, such as applets, where the arguments
are passed using name value pairs,
javafx.lang.FX.getArguments(key:String)
:String[]
. Similarly, there is a function to get system properties,
javafx.lang.FX
.getProperty(key:String):String[]
.
If the script contains any exported classes, variables, or functions, arguments are
obtained by defining a special
run
function at the script level.
public function run(args:String[] ) {
for(arg in args) {
println("{arg}");
}
}
Loose Expressions with Exported Members:
Variables, functions, and expres-
sions at the script level (not within a class declaration) are called
loose expressions
.
When these variables and functions are private to the script, no specific
run
func-
tion is required if the script is executed from the command line. However, if any of
these expressions are exported outside of the script using public, public-read, pro-
tected, package access, a
run
function is required if the script is to be executed
directly. This
run
method encapsulates the exported variables and functions.
There are a set of functions that are automatically available to all JavaFX scripts.
These functions are defined in
javafx.lang.Builtins
.
Search WWH ::
Custom Search