GWT 2.7.0

com.google.gwt.core.shared
Class GWT

java.lang.Object
  extended by com.google.gwt.core.shared.GWT

public final class GWT
extends java.lang.Object

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
GWT()
           
 
Method Summary
static
<T> T
create(java.lang.Class<?> classLiteral)
          Instantiates a class via deferred binding.
static
<T> T
createImpl(java.lang.Class<?> classLiteral)
          Instantiates a class via deferred binding.
static void debugger()
          Emits a JavaScript "debugger" statement on the line that called this method.
static java.lang.String 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.
static java.lang.String getVersion()
          Get a human-readable representation of the GWT version used, or null if this is running on the client.
static boolean isClient()
          Returns true when running inside the normal GWT environment, either in Development Mode or Production Mode.
static boolean isProdMode()
          Returns true when running in production mode.
static boolean isScript()
          Determines whether or not the running program is script or bytecode.
static void log(java.lang.String message)
          Logs a message to the development shell logger in Development Mode, or to the JavaScript console in Super Dev Mode.
static void log(java.lang.String message, java.lang.Throwable e)
          Logs a message to the development shell logger in Development Mode, or to the JavaScript console in Super Dev Mode.
static void setBridge(GWTBridge bridge)
          Called via reflection in Development Mode; do not ever call this method in Production Mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GWT

public GWT()
Method Detail

create

public static <T> T create(java.lang.Class<?> classLiteral)
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 a Class variable 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

public static <T> T createImpl(java.lang.Class<?> classLiteral)
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

public static java.lang.String 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

public static java.lang.String 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()
Returns true when running inside the normal GWT environment, either in Development Mode or Production Mode. Returns false if 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()
Returns true when running in production mode. Returns false when 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

public static void log(java.lang.String message)
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

public static void log(java.lang.String message,
                       java.lang.Throwable e)
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.


setBridge

public static void setBridge(GWTBridge bridge)
Called via reflection in Development Mode; do not ever call this method in Production Mode. May be called in server code to initialize server bridge.


GWT 2.7.0