Module java.base

Interface TemplateProcessor<R>

Type Parameters:
R - Processor's process result type.
All Superinterfaces:
All Known Subinterfaces:
All Known Implementing Classes:
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface TemplateProcessor<R> extends ValidatingProcessorPREVIEW<R,RuntimeException>
TemplateProcessor is a preview API of the Java platform.
Programs can only use TemplateProcessor when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
This interface is used to implement template processors that do not throw checked exceptions. Any implementation must supply a process(StringTemplate) method that constructs a result from the information provided by the supplied StringTemplatePREVIEW instance.

For example:

TemplateProcessor<Integer> processor = st -> {
    String interpolation = st.interpolate();
    return Integer.valueOf(interpolation);
Implementation Note:
It is recommended that StringProcessorPREVIEW be used instead of TemplateProcessor<String> when the result type is String.
See Java Language Specification:
15.8.6 Process Template Expressions
See Also:
  • Method Summary

    Modifier and Type
    Constructs a result based on the template fragments and values in the supplied stringTemplatePREVIEW instance.