@Retention(value=RUNTIME)
@Target(value=TYPE)
@Documented
public @interface JsType
Marking an object with JsType is similar to marking each public member of the class with
JsProperty/JsMethod/JsConstructor respectively. In order for this to work
correctly the JavaScript name needs to be unique for each member. Some unobvious ways to cause
name collisions are:
Name collisions must be avoided by providing custom names (e.g. JsProperty.name()) or by
ignoring members using JsIgnore.
If the JsType is marked as "native" via isNative(), then the type is considered a stub
for an existing class that is available in native JavaScript. Unlike non-native JsTypes, all
members are considered JsProperty/JsMethod/JsConstructor unless they are
explicitly marked with JsOverlay.
For native interfaces with no particular JavaScript type associated with them (e.g.
structural types) it is recommeded to use namespace = JsPackage.GLOBAL and
name = '?'.
Instanceof and Castability:
If the JsType is native, the generated code will try to mimic Javascript semantics.
All non-native JsTypes will follow regular Java semantics in terms of castability.
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
isNative
Set to
true, this JsType is a native JavaScript type. |
java.lang.String |
name
Customizes the name of the type in generated JavaScript.
|
java.lang.String |
namespace
Customizes the namespace of the type in generated JavaScript.
|
public abstract java.lang.String name