public class JavaScript extends Object
Encapsulates JavaScript definitions.
Able to load JavaScript code from file or from classpath resource.
| Constructor and Description |
|---|
JavaScript(String source)
Instantiates a new JavaScript.
|
| Modifier and Type | Method and Description |
|---|---|
JavaScript |
append(String sourceCodeToAppend)
Append the JavaScript part to end of the this JavaScript
|
static JavaScript |
fromFile(File sourceFile)
Loads the JavaScript from file.
|
static JavaScript |
fromResource(String resourceName)
Loads the JavaScript from classpath resource.
|
static JavaScript |
fromString(String source)
The factory method for JavaScript object
|
String |
getSourceCode() |
JavaScript |
join(JavaScript javaScriptToJoin)
Joins this JavaScript object with another JavaScript object to single JavaScript.
|
String |
toString() |
public JavaScript(String source)
source - the JavaScript source codepublic static JavaScript fromFile(File sourceFile)
sourceFile - the source fileRuntimeException - when failed to load a scriptpublic static JavaScript fromResource(String resourceName)
resourceName - the resource name, e.g. "org/jboss/test/..."RuntimeException - when failed to load a scriptpublic static JavaScript fromString(String source)
source - the JavaScript source codepublic JavaScript join(JavaScript javaScriptToJoin)
javaScriptToJoin - the JavaScript object we want to join withpublic JavaScript append(String sourceCodeToAppend)
sourceCodeToAppend - JavaScript source code to append on the end of this JavaScriptpublic String getSourceCode()
Copyright © 2013 JBoss by Red Hat. All Rights Reserved.