Interface TargetTypeMapping<T>

Type Parameters:
T - The target type

public interface TargetTypeMapping<T>
Strategy interface that defines a host target type mapping for GraalVM HostAccess. Implementations are discovered as beans and registered with HostAccess so that Value.as(TargetType) can convert guest values to the desired host type.
Since:
5.2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default @NonNull Class<?>[]
     
    @NonNull T
    convert(@NonNull org.graalvm.polyglot.Value value)
    Convert the given polyglot value to the target type.
    @NonNull Class<T>
     
  • Method Details

    • targetType

      @NonNull Class<T> targetType()
      Returns:
      The exact target class this mapping supports
    • assignableTargetTypes

      default @NonNull Class<?>[] assignableTargetTypes()
      Returns:
      Additional erased Java target classes this mapping can satisfy.
    • convert

      @NonNull T convert(@NonNull org.graalvm.polyglot.Value value)
      Convert the given polyglot value to the target type. Invoked by HostAccess when resolving Value.as(targetType).
      Parameters:
      value - The guest value to convert
      Returns:
      The converted host value