Module java.base

Interface ProcessorLinkage

All Known Implementing Classes:
FormatProcessorPREVIEW

public sealed interface ProcessorLinkage permits FormatProcessorPREVIEW
ProcessorLinkage is a preview API of the Java platform.
Programs can only use ProcessorLinkage when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Policies using this additional interface have the flexibility to specialize the composition of the templated string by returning a customized MethodHandle from linkage. These specializations are typically implemented to improve performance; specializing value types or avoiding boxing and vararg arrays.
Implementation Note:
This interface is sealed to only allow standard processors.
Since:
21
  • Method Summary

    Modifier and Type
    Method
    Description
    linkage(List<String> fragments, MethodType type)
    This method creates a MethodHandle that when invoked with arguments of those specified in type returns a result that equals that returned by the template processor's process method.
  • Method Details

    • linkage

      MethodHandle linkage(List<String> fragments, MethodType type)
      This method creates a MethodHandle that when invoked with arguments of those specified in type returns a result that equals that returned by the template processor's process method. The difference being that this method can preview the template's fragments and value types in advance of usage and thereby has the opportunity to produce a specialized implementation.
      Parameters:
      fragments - string template fragments
      type - method type
      Returns:
      MethodHandle for the processor applied to template
      Throws:
      NullPointerException - if any of the arguments are null