Module java.base
Package java.lang

# Interface StringTemplate.Processor.Linkage

All Known Implementing Classes:
  `FormatProcessorPREVIEW`

Enclosing interface:
  `StringTemplate.ProcessorPREVIEW<R,E extends Throwable>`

public static sealed interface StringTemplate.Processor.Linkage permits FormatProcessorPREVIEW
`Linkage` is a preview API of the Java platform.
Programs can only use `Linkage` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Built-in 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
  `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.

- ## 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, includes the StringTemplate receiver as well as the value types
    Returns:
      `MethodHandle` for the processor applied to template
    Throws:
      `NullPointerException` - if any of the arguments are null