Class JavaScript
java.lang.Object
org.jboss.arquillian.graphene.spi.javascript.JavaScript
Encapsulates JavaScript definitions.
Able to load JavaScript code from file or from classpath resource.
- Author:
- Lukas Fryc, Jan Papousek
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppend the JavaScript part to end of the this JavaScriptstatic JavaScriptLoads the JavaScript from file.static JavaScriptfromResource(String resourceName) Loads the JavaScript from classpath resource.static JavaScriptfromString(String source) The factory method for JavaScript objectReturns the source of hold by thisJavaScriptobject instance.join(JavaScript javaScriptToJoin) Joins this JavaScript object with another JavaScript object to single JavaScript.toString()
-
Constructor Details
-
JavaScript
Instantiates a new JavaScript.- Parameters:
source- the JavaScript source code
-
-
Method Details
-
fromFile
Loads the JavaScript from file.- Parameters:
sourceFile- the source file- Returns:
- the JavaScript object loaded from file
- Throws:
RuntimeException- when failed to load a script
-
fromResource
Loads the JavaScript from classpath resource.- Parameters:
resourceName- the resource name, e.g. "org/jboss/test/..."- Returns:
- the JavaScript object loaded from classpath resource
- Throws:
RuntimeException- when failed to load a script
-
fromString
The factory method for JavaScript object- Parameters:
source- the JavaScript source code- Returns:
- the new JavaScript object with predefined JavaScript code
-
join
Joins this JavaScript object with another JavaScript object to single JavaScript.- Parameters:
javaScriptToJoin- the JavaScript object we want to join with- Returns:
- the joined JavaScript object
-
append
Append the JavaScript part to end of the this JavaScript- Parameters:
sourceCodeToAppend- JavaScript source code to append on the end of this JavaScript- Returns:
- this JavaScript with javaScriptPartToAppend appended
-
getSourceCode
Returns the source of hold by thisJavaScriptobject instance. -
toString
-