xapi.annotation.reflect.KeepConstructor Maven / Gradle / Ivy
Show all versions of xapi-gwt Show documentation
package xapi.annotation.reflect;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation used to tell reflection subsystem to hold onto field data.
*
* Can be applied to packages, classes and specific fields.
*
* Primarily used in gwt reflection, but available as well for future
* iterations of classpath scanner to intelligently discard runtime metadata.
*
* @author "James X. Nelson ([email protected])"
*/
@Documented
@Target(value= {CONSTRUCTOR, TYPE, PACKAGE})
@Retention(RetentionPolicy.RUNTIME)
public @interface KeepConstructor {
/**
* DebugData to include.
* @return "" (default) = no debug data / production mode
* "anything" = keep this string, and print extra debug logging.
*
* Using debugData.length > 0 will result in as much type data being preserved
* as possible in log messages, including parameter type debug data.
*/
String debugData() default "";
/**
* Whether or not to defer including reflected constructor
* into a code split containing all reflection data.
*
* Implementations using xapi-gwt-inject won't need to worry as much,
* the magic-method-injector will ensure code bloat is localized to call site.
*
* Running without injection support will put all class data into a single,
* monolithic, generated factory for the whole app, unless async is used.
*
* @return true to force this code into async split.
* false (default) to load synchronously; no boilerplate.
*
* if true,
* Generator will throw exception if accessed outside of X_Reflect.async()
*/
boolean loadAsync() default false;
/**
* Used to allow package-level or type-level annotations to override children.
*
* Good for overriding default settings temporarily; setting debugData and
* preventOverride on package-info.java will turn on debugging for that package.
*
* @return true, to prevent checking for more specific child types.
*
* Inheritance Hierarchy Is ->
* package-info.java -> OuterClass -> OuterClass$InnerClass -> ...
*/
boolean preventOverride() default false;
}