Top Description Inners Fields Constructors Methods
org.graalvm.polyglot

public final Class HostAccess

extends Object
Class Inheritance
Imports
java.lang.annotation.Annotation, .ElementType, .Retention, .RetentionPolicy, .Target, java.lang.invoke.MethodHandles, .MethodHandles.Lookup, java.lang.reflect.AnnotatedElement, .Constructor, .Executable, .Field, .Method, java.util.ArrayList, .Arrays, .Iterator, .List, .Map, .Objects, java.util.function.Function, .Predicate, org.graalvm.collections.EconomicMap, .EconomicSet, .Equivalence, .MapCursor

Represents the host access policy of a polyglot context. The host access policy specifies which methods and fields are accessible to the guest application, whenever Java host objects are accessed.

There are three predefined instances of host access policies:

Custom host access policies can be created using newBuilder(). The builder allows to specify a custom export annotation and allowed and denied methods or fields.
Since
19.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
HostAccess.Builder

Builder to create a custom host access policy.

public static @interface
HostAccess.DisableMethodScoping

If HostAccess#SCOPED is used, placing this annotation on an exported host function excludes it from parameter scoping, i.e. parameters will not be released after invocation of a callback.

public static @interface
HostAccess.Export

Annotation used by the predefined EXPLICIT access policy to mark public constructors, methods and fields in public classes that should be accessible by the guest application.

public static @interface
HostAccess.Implementable

Allows guest language to implement a Java type.

public static enum
HostAccess.MutableTargetMapping

List of default host object mappings of mutable target types available in Value#as(Class).

public static enum
HostAccess.TargetMappingPrecedence

Represents the precedence of a target type mapping.

Field Summary

Modifier and TypeField and Description
private final EconomicSet<Class<? extends Annotation>>
public static final HostAccess
ALL

Predefined host access policy that allows full unrestricted access to public methods or fields of public host classes.

pack-priv final boolean
pack-priv final boolean
pack-priv final boolean
pack-priv final boolean
pack-priv final boolean
pack-priv final boolean
pack-priv final boolean
pack-priv final boolean
pack-priv final boolean
pack-priv final boolean
private final HostAccess.MutableTargetMapping[]
pack-priv final boolean
public static final HostAccess
CONSTRAINED

Predefined host access policy used by Context with a SandboxPolicy#CONSTRAINED sandbox policy when the host access policy is not explicitly specified by the embedder.

private final EconomicSet<Executable>
private final EconomicSet<Class<? extends Annotation>>
private static final HostAccess
private final EconomicMap<Class<?>, Boolean>
public static final HostAccess
EXPLICIT

Predefined host access policy that allows access to public host methods or fields that were annotated with @Export and were declared in public class.

pack-priv volatile Object
pack-priv final EconomicSet<Class<? extends Annotation>>
private final EconomicSet<Class<?>>
public static final HostAccess
ISOLATED

Predefined host access policy used by Context with an SandboxPolicy#ISOLATED sandbox policy when the host access policy is not explicitly specified by the embedder.

private final EconomicSet<AnnotatedElement>
pack-priv final MethodHandles.Lookup
private final boolean
private final String
public static final HostAccess
NONE

Predefined host access policy that disallows any access to public host methods or fields.

public static final HostAccess
SCOPED

Predefined host access policy that is the same as EXPLICIT and enables method scoping of callback parameter values on top.

private final List<Object>
public static final HostAccess
UNTRUSTED

Predefined host access policy used by Context with an SandboxPolicy#UNTRUSTED sandbox policy when the host access policy is not explicitly specified by the embedder.

Constructor Summary

AccessConstructor and Description
pack-priv
HostAccess(EconomicSet<Class<? extends Annotation>> annotations, EconomicMap<Class<?>, Boolean> excludeTypes, EconomicSet<AnnotatedElement> members, EconomicSet<Class<? extends Annotation>> implementableAnnotations, EconomicSet<Class<?>> implementableTypes, List<Object> targetMappings, String name, boolean allowPublic, boolean allowAllImplementations, boolean allowAllClassImplementations, boolean allowArrayAccess, boolean allowListAccess, boolean allowBufferAccess, boolean allowIterableAccess, boolean allowIteratorAccess, boolean allowMapAccess, boolean allowBigIntegerNumberAccess, boolean allowAccessInheritance, HostAccess.MutableTargetMapping[] allowMutableTargetMappings, boolean methodScopingDefault, EconomicSet<Class<? extends Annotation>> disableMethodScopingAnnotations, EconomicSet<Executable> disableMethodScoping, MethodHandles.Lookup methodLookup)

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
pack-priv boolean
private static <K, T> EconomicMap<K, T>
copyMap(EconomicMap<K, T> values, Equivalence equivalence)

private static <T> EconomicSet<T>
copySet(EconomicSet<T> values, Equivalence equivalence)

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

private static <T, V> boolean
equalsMap(EconomicMap<T, V> map0, EconomicMap<T, V> map1)

private static <T> boolean
equalsSet(EconomicSet<T> set0, EconomicSet<T> set1)

private static Class<?>
pack-priv HostAccess.MutableTargetMapping[]
pack-priv List<Object>
private static boolean
hasAnnotation(AnnotatedElement member, Class<? extends Annotation> annotationType)

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.

private static <T, V> int
hashMap(EconomicMap<T, V> map)

private static <V> int
pack-priv boolean
pack-priv boolean
public static HostAccess.Builder
newBuilder()

Creates a new builder that allows to create a custom host access policy.

public static HostAccess.Builder
newBuilder(HostAccess conf)

Creates a new builder that allows to create a custom host access policy based of a preset configuration.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait