public class ConstPool extends JavaScriptObject
| Modifier and Type | Class and Description |
|---|---|
static class |
ConstPool.ArrayConsts |
static interface |
ConstPool.ClassConsts |
static class |
ConstPool.Ids |
| Modifier and Type | Field and Description |
|---|---|
(package private) static ConstPool |
CONSTS |
| Modifier | Constructor and Description |
|---|---|
protected |
ConstPool() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
arraySet(int id,
java.lang.Object array) |
static java.lang.Iterable<java.lang.Class<?>> |
extractClasses(java.lang.ClassLoader loader)
Extracts all available classes from the given classloader.
|
java.lang.Iterable<java.lang.Class<?>> |
getAllClasses() |
java.lang.Iterable<ClassMap<?>> |
getAllEnhancedClasses() |
java.lang.Iterable<JsMemberPool<?>> |
getAllReflectionData() |
<T> T |
getAnnotation(int id) |
int[] |
getArrayInt(int id) |
<T> T[] |
getArrayObjects(int id) |
<T> java.lang.Class<T> |
getClass(int id) |
java.lang.Class<?> |
getClassByName(java.lang.String className) |
(package private) <T> ClassMap<T> |
getClassData(java.lang.Class<?> c) |
(package private) <T> ClassMap<T> |
getClassData(java.lang.String pkg,
java.lang.String cls) |
static ConstPool |
getConstPool() |
boolean |
getDouble(int id) |
<E extends java.lang.Enum<E>> |
getEnum(int id) |
int |
getInt(int id) |
long |
getLong(int id) |
java.lang.String |
getString(int id) |
static boolean |
isPrimitive(int constId)
Uses a quick switch statement to determine if the supplied constId is that
of a primitive class.
|
protected static boolean |
isPrimitiveArray(java.lang.Object array)
Used to detmine if the array has a primitive component type or not
|
static void |
loadConstPool(Callback<ConstPool,java.lang.Throwable> callback)
WARNING!!
|
static <T> T[] |
setArray(java.lang.Class<?> componentType,
T[] array)
Used to retain a reference to an empty array of the given type so that we
can use that array as a seed for performing array reflection.
|
protected static void |
setEnhancedClass(int constId,
ClassMap<?> cls)
Used to store a global reference to the
ClassMap used to supply
reflection objects on demand. |
static java.lang.Object |
setPrimitiveArray(java.lang.Class<?> componentType,
java.lang.Object array)
The same method call as
setArray(Class, Object[]), but with some
extra assertions to make sure the array does, indeed, have a primitive
component type. |
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toStringstatic final ConstPool CONSTS
public static java.lang.Iterable<java.lang.Class<?>> extractClasses(java.lang.ClassLoader loader)
loader - -> The classloader to read fromIn both Gwt and Jvms, this Iterable will only contain classes that have been loaded at the present execution time; if there will be more classes loaded later (via runAsync or regular classloading), this method will NOT find those classes.
This is not a classpath scanner. If, for Gwt, you do want to load
all types that are to include reflection metadata, see
loadConstPool(Callback) instead.
public static ConstPool getConstPool()
public static boolean isPrimitive(int constId)
public static void loadConstPool(Callback<ConstPool,java.lang.Throwable> callback)
Use of this method will cause the inclusion of ALL types annotated with
ReflectionStrategy, and all type and member dependencies declared
with GwtRetention.
The GWT#runAsync class id for this split point is
com.google.gwt.reflect.client.ConstPool.
This _MIGHT_ be what you want, but it _WILL_ slow down your compile, and cause some code bloat.
In order to mitigate some of these negative effects, the code containing this monolithic collection of classes, methods, fields, constructors, annotations and constants will be put behind it's own GWT.runAsync split point.
However, you must still use some responsibility in calling this method.
The best place to call it is AFTER you've loaded your bootstrap code (exclusive code fragments), and BEFORE your non-exclusive left-over fragments. This will allow your bootstrap to remain lean, and then you suck in all the types and members of core shared code into an exclusive fragment, so all your non-exclusive leftovers will only contain unique code, with minimal clinit() calls sprinkled around (since all shared code will already have clinit() called).
callback - public static <T> T[] setArray(java.lang.Class<?> componentType,
T[] array)
It is very unlikely that you should ever call this method manually.
componentType - -> The component type of the arrayarray - -> An array. Preferably size 0.public static java.lang.Object setPrimitiveArray(java.lang.Class<?> componentType,
java.lang.Object array)
setArray(Class, Object[]), but with some
extra assertions to make sure the array does, indeed, have a primitive
component type.protected static boolean isPrimitiveArray(java.lang.Object array)
protected static void setEnhancedClass(int constId,
ClassMap<?> cls)
ClassMap used to supply
reflection objects on demand.public final java.lang.Iterable<java.lang.Class<?>> getAllClasses()
public final java.lang.Iterable<ClassMap<?>> getAllEnhancedClasses()
public final java.lang.Iterable<JsMemberPool<?>> getAllReflectionData()
public final <T> T getAnnotation(int id)
public final int[] getArrayInt(int id)
public final <T> T[] getArrayObjects(int id)
public final <T> java.lang.Class<T> getClass(int id)
public final java.lang.Class<?> getClassByName(java.lang.String className)
public final boolean getDouble(int id)
public final <E extends java.lang.Enum<E>> E getEnum(int id)
public final int getInt(int id)
public final long getLong(int id)
public final java.lang.String getString(int id)
protected final void arraySet(int id,
java.lang.Object array)
final <T> ClassMap<T> getClassData(java.lang.Class<?> c)
final <T> ClassMap<T> getClassData(java.lang.String pkg, java.lang.String cls)