W3cubDocs

/OpenJDK 21

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

© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/StringTemplate.Processor.Linkage.html