Package com.google.gwt.core.shared
Class GWT
java.lang.Object
com.google.gwt.core.shared.GWT
Supports core functionality that in some cases requires direct support from
the compiler and runtime systems such as runtime type information and
deferred binding.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TInstantiates a class via deferred binding.static <T> TcreateImpl(Class<?> classLiteral) Instantiates a class via deferred binding.static voiddebugger()Emits a JavaScript "debugger" statement on the line that called this method.static StringReturns the empty string when running in Production Mode, but returns a unique string for each thread in Development Mode (for example, different windows accessing the dev mode server will each have a unique id, and hitting refresh without restarting dev mode will result in a new unique id for a particular window.static StringGet a human-readable representation of the GWT version used, or null if this is running on the client.static booleanisClient()Returnstruewhen running inside the normal GWT environment, either in Development Mode or Production Mode.static booleanReturnstruewhen running in production mode.static booleanisScript()Determines whether or not the running program is script or bytecode.static voidLogs a message to the development shell logger in Development Mode, or to the JavaScript console in Super Dev Mode.static voidLogs a message to the development shell logger in Development Mode, or to the JavaScript console in Super Dev Mode.static voidCalled via reflection in Development Mode; do not ever call this method in Production Mode.
-
Constructor Details
-
GWT
public GWT()
-
-
Method Details
-
create
Instantiates a class via deferred binding.The argument to
create(Class)must be a class literal because the Production Mode compiler must be able to statically determine the requested type at compile-time. This can be tricky because using aClassvariable may appear to work correctly in Development Mode.- Parameters:
classLiteral- a class literal specifying the base class to be instantiated- Returns:
- the new instance, which must be cast to the requested class
-
createImpl
Instantiates a class via deferred binding.- Parameters:
classLiteral- a class literal specifying the base class to be instantiated- Returns:
- the new instance, which must be cast to the requested class
-
getUniqueThreadId
Returns the empty string when running in Production Mode, but returns a unique string for each thread in Development Mode (for example, different windows accessing the dev mode server will each have a unique id, and hitting refresh without restarting dev mode will result in a new unique id for a particular window. TODO(unnurg): Remove this function once Dev Mode rewriting classes are in gwt-dev. -
getVersion
Get a human-readable representation of the GWT version used, or null if this is running on the client.- Returns:
- a human-readable version number, such as
"2.5"
-
isClient
public static boolean isClient()Returnstruewhen running inside the normal GWT environment, either in Development Mode or Production Mode. Returnsfalseif this code is running in a plain JVM. This might happen when running shared code on the server, or during the bootstrap sequence of a GWTTestCase test. -
isProdMode
public static boolean isProdMode()Returnstruewhen running in production mode. Returnsfalsewhen running either in development mode, or when running in a plain JVM. -
isScript
public static boolean isScript()Determines whether or not the running program is script or bytecode. -
log
Logs a message to the development shell logger in Development Mode, or to the JavaScript console in Super Dev Mode. Calls are optimized out in Production Mode. -
log
Logs a message to the development shell logger in Development Mode, or to the JavaScript console in Super Dev Mode. Calls are optimized out in Production Mode. -
debugger
public static void debugger()Emits a JavaScript "debugger" statement on the line that called this method. If the user has the browser's debugger open, the debugger will stop when the GWT application executes that line. There is no effect in Dev Mode or in server-side code.
-