/** * Returns <code>true</code> when running in production mode. Returns * <code>false</code> when running either in development mode, or when running * in a plain JVM. */ public static boolean isProdMode() { return com.google.gwt.core.shared.GWT.isProdMode(); }
/** * Returns <code>true</code> when running in production mode. Returns * <code>false</code> when running either in development mode, or when running * in a plain JVM. */ public static boolean isProdMode() { return com.google.gwt.core.shared.GWT.isProdMode(); }
/** * Returns <code>true</code> when running in production mode. Returns * <code>false</code> when running either in development mode, or when running * in a plain JVM. */ public static boolean isProdMode() { return com.google.gwt.core.shared.GWT.isProdMode(); }
/** * Returns <code>true</code> when running in production mode. Returns * <code>false</code> when running either in development mode, or when running * in a plain JVM. */ public static boolean isProdMode() { return com.google.gwt.core.shared.GWT.isProdMode(); }
public static Object arrayGet(Object array, int index) { if (GWT.isProdMode()) return jsniGet(array, index); else return Array.get(array, index); }
/** * In jvms, we defer to java.lang.reflect.Array; * In gwt, java.lang.reflect.Array defers to here, * where the compiler will call into the c.g.g.jjs.instrinc.c.g.g.lang super source. * * @param array - Any array[] instance; java or js * @return - The number of elements in the []. */ public static int arrayLength(Object array) { if (GWT.isProdMode()) return jsniLength(array); else return Array.getLength(array); }
/** * In jvms, we defer to java.lang.reflect.Array; In Gwt, we just return the * .length property. * * @param array * - Any array[] instance; java or js * @return - The number of elements in the []. */ public static int arrayLength(final Object array) { if (GWT.isProdMode()) { return jsniLength(array); } else { return Array.getLength(array); } }
/** * Creates a new event bus. In dev mode, any exceptions that occur while dispatching events will * be logged with {@link GWT#log}. In prod mode, exceptions are silently ignored unless a handler * is added via {@link #addExceptionHandler}. */ public EventBus() { if (!GWT.isProdMode()) { addExceptionHandler(new ExceptionHandler() { @Override public void handleException(EventBusException e) { GWT.log("Got exception when handling event \"" + e.getEvent() + "\"", e.getCause()); } }); } }
/** * Retrieve an object from a given array using the most efficient solution for * a given platform. In Gwt, this does a direct int index access on the * supplied array object; in a JRE, it uses {@link Array#get(Object, int)}. * <p> * Note that JREs will throw {@link IndexOutOfBoundsException}, while Gwt will * not. * * @param array * -> The array to load from * @param index * -> The index to load from. * @return The object at the specified index. */ public static Object arrayGet(final Object array, final int index) { if (GWT.isProdMode()) { return jsniGet(array, index); } else { return Array.get(array, index); } }
@SuppressWarnings("unchecked") public static Iterable<Class<?>> extractClasses(ClassLoader loader) { try { Object classes = GwtReflect.fieldGet(ClassLoader.class, "classes", loader); if (GWT.isProdMode()) { // we have a js object of classes JavaScriptObject all = (JavaScriptObject)classes; return fillArray(new ArrayList<Class<?>>(), all); } else { // standard jvm. Hope this works (should be a Vector<Class>)! return (Collection<Class<?>>)classes; } } catch (Exception e) { throw e instanceof RuntimeException ? (RuntimeException)e : new RuntimeException(e); } }
public static Package getPackage(final String name) { if (GWT.isProdMode()) { return Package.getPackage(name); } else { return GwtReflectJre.getPackage(name); } }
public static Package getPackage(String name) { if (GWT.isProdMode()) { return Package.getPackage(name); } else { return GwtReflectJre.getPackage(name); } }
public static String joinClasses(final String separator, final Class<?> ... vals) { if (GWT.isProdMode()) { return joinClassesJs(separator, vals);
if (GWT.isProdMode()) { return nativeEscape(unescaped);
final Object classes = GwtReflect.fieldGet(ClassLoader.class, "classes", loader); if (GWT.isProdMode()) {