- All Known Implementing Classes:
FormatProcessorPREVIEW
- Enclosing interface:
StringTemplate.ProcessorPREVIEW<R,
E extends Throwable>
Linkage
is a preview API of the Java platform.
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 TypeMethodDescriptionlinkage
(List<String> fragments, MethodType type) This method creates aMethodHandle
that when invoked with arguments of those specified intype
returns a result that equals that returned by the template processor's process method.
-
Method Details
-
linkage
This method creates aMethodHandle
that when invoked with arguments of those specified intype
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 fragmentstype
- 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
-
Linkage
when preview features are enabled.