public final class JsAccessibleClasses
extends java.lang.Object
JavaScript
.
It should be used to grant access to core Java classes or autogenerated code when the JsAccessible annotation is not possible to apply.
When the access is granted to a class, only its public declared non-static methods/fields are allowed to be called from JavaScript. The inherited methods/fields are not accessible.
JsAccessible
Modifier and Type | Method and Description |
---|---|
static void |
add(java.lang.Class<?>... publicClasses)
Adds the
publicClasses to the classes that are accessible from JavaScript . |
static boolean |
contains(java.lang.Class<?> cls)
Defines whether the class is accessible from
JavaScript . |
static void |
remove(java.lang.Class<?>... publicClasses)
Removes access to the
publicClasses from JavaScript . |
public static void add(java.lang.Class<?>... publicClasses)
publicClasses
to the classes that are accessible from JavaScript
.
Only public classes are allowed as an argument. Passing the enum, interface or
annotation type results in NotClassException
.
publicClasses
- classes to be added to the available onesNotClassException
- if a class in the classes
array has the interface, enum or
annotation typeClassNotPublicException
- if the publicClasses
contains a class without a
public modifierpublic static void remove(java.lang.Class<?>... publicClasses)
publicClasses
from JavaScript
.
If the publicClasses
contains a class that is not accessible,
the method does not react in any way.
publicClasses
- classes to be removed from the available onespublic static boolean contains(java.lang.Class<?> cls)
JavaScript
.cls
- the class to check for accessibilitytrue
if the class is accessible