Class JsAccessibleTypes

java.lang.Object
com.teamdev.jxbrowser.js.JsAccessibleTypes

public final class JsAccessibleTypes extends Object
A registry of types that are accessible from JavaScript.

It can be used to grant access to the types that cannot be made accessible for JavaScript via the JsAccessible annotation, such as core Java classes.

The rules for making a type accessible from JavaScript are just the same as for the JsAccessible annotation.

This class does not include the types that are made accessible from JavaScript via the JsAccessible annotation. The methods of this class cannot be used to add, remove, or check accessibility for a type annotated with the JsAccessible annotation.

Since:
7.20
  • Method Details

    • makeAccessible

      public static void makeAccessible(Class<?>... publicTypes)
      Adds the publicTypes to the types that are accessible from JavaScript.

      Only public classes and interfaces are allowed as an argument. Passing an enum or an annotation type results in NotSupportedTypeException.

      Parameters:
      publicTypes - the types to be made accessible
      Throws:
      NotSupportedTypeException - if a type in the publicTypes array is an enum or an annotation
      TypeNotPublicException - if the publicTypes array contains a type without the public modifier
    • makeInaccessible

      public static void makeInaccessible(Class<?>... publicTypes)
      Removes the publicTypes from the types that are accessible from JavaScript.

      Does nothing if the publicTypes array contains a type that is not accessible.

      Parameters:
      publicTypes - the types to be removed from the accessible ones
    • isAccessible

      public static boolean isAccessible(Class<?> type)
      Indicates whether the type is made accessible to JavaScript using this class.
      Parameters:
      type - the type to check for accessibility
      Returns:
      true if the type is accessible