@Target(value={TYPE,PACKAGE})
@Retention(value=RUNTIME)
public @interface ReflectionStrategy
| Modifier and Type | Fields and Description |
|---|---|
static int |
ALL_ANNOTATIONS |
static int |
ALL_MEMBERS |
static int |
ANNOTATION |
static int |
COMPILE |
static int |
CONSTRUCTOR |
static int |
FIELD |
static int |
INHERITED |
static int |
META |
static int |
METHOD |
static int |
NONE |
static int |
RUNTIME |
static int |
SOURCE |
static int |
TYPE |
| Modifier and Type | Optional Element and Description |
|---|---|
int |
annotationRetention
An int register of annotation-retention level;
if set to
NONE, no annotations will be kept for any members,
otherwise, this sets the retention level for this type only;
to set member-level return, you can set global member retention via memberRetention(),
member-type level retention via methodRetention(), constructorRetention(),
typeRetention() and fieldRetention(). |
GwtRetention |
constructorRetention |
int |
debug
An int register of member types that should emit debug data.
|
GwtRetention |
fieldRetention |
boolean |
keepCodeSource
Whether or not to include the file url to the source file, as returned by
Class.class.getProtectionDomain().getCodeSource().getLocation().getPath();
|
boolean |
keepEverything
Simple flag to mark a type (or package) that should keep all reflection data.
|
boolean |
keepInnerTypes
Whether or not to automatically retain inner classes.
|
boolean |
keepNothing
Simple flag to mark a type (or package) that should keep zero reflection data.
|
boolean |
keepPackage |
boolean |
magicSupertypes
Set to true to retain all ancestors' public fields.
|
GwtRetention[] |
memberRetention
If you return any retention level here, it will override the defaults in
methodRetention(),
constructorRetention(), fieldRetention() and typeRetention(). |
GwtRetention |
methodRetention
Define a retention policy for all methods within the annotated class or package.
|
java.lang.Class<? extends NewInstanceStrategy> |
newInstanceStrategy |
GwtRetention |
typeRetention |
public abstract boolean magicSupertypes
Ancestors (supertypes and interfaces) will be checked for public members, and will have reflection data written for those members (via clinit on supertypes) when the direct .getMethod(), .getMethods(), etc is called (versus the more precise .getDeclaredMethod(), .getDeclaredMethods()).
public abstract boolean keepNothing
public abstract boolean keepEverything
USE AT YOUR OWN RISK. Use -compileReport and -extra to view how much code is added when you apply this setting. In the case of large classes that would be pruned, this could easily triple the amount of compiled output.
That said, if you want a complete jvm-compatible class without tweaking anything, just set this to true (but do try to avoid doing so at the package level).
public abstract boolean keepCodeSource
Ya, it's pretty ugly, but that's how to get a classes compiled location in any jvm that supports it.
Setting this value to true imposes a security risk!
This will compile locations of files on your harddrive into your application. If you do not understand the security implications of this, you should NOT use this in any production application.
public abstract boolean keepInnerTypes
The default of false is to help reduce default code size; you can annotate your subtypes manually; this just makes it easier to paint with a broader brush.
public abstract java.lang.Class<? extends NewInstanceStrategy> newInstanceStrategy
NewInstanceStrategy contract.
Allow for easy injection of new instance strategies; provided defaults are new Type(), and GWT.create(Type.class);.
Default is new Type(), or throw Exception() if no suitable constructor is available.
public abstract GwtRetention methodRetention
A class-level ReflectionStrategy completely overrides a package level one.
The default retention strategy is to synchronously include all declared members, and no supertype members.
public abstract GwtRetention constructorRetention
public abstract GwtRetention fieldRetention
public abstract GwtRetention typeRetention
public abstract GwtRetention[] memberRetention
methodRetention(),
constructorRetention(), fieldRetention() and typeRetention().
This is a convenience method so you do not have to type a pile of code to retain all annotations.
Only the first value in the array is returned. An array is merely used to provide the concept of null.
public abstract int annotationRetention
NONE, no annotations will be kept for any members,
otherwise, this sets the retention level for this type only;
to set member-level return, you can set global member retention via memberRetention(),
member-type level retention via methodRetention(), constructorRetention(),
typeRetention() and fieldRetention().
You may override any defaults by annotating individual members with @GwtRetention.
public abstract int debug
TYPE, CONSTRUCTOR, FIELD, METHOD and ANNOTATION