Module java.base

Interface StringProcessor

All Superinterfaces:
TemplateProcessorPREVIEW<String>, ValidatingProcessorPREVIEW<String,RuntimeException>
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 StringProcessor extends TemplateProcessorPREVIEW<String>
StringProcessor is a preview API of the Java platform.
Programs can only use StringProcessor 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 only produce String results. Any implementation must supply a process(StringTemplate) method that constructs a result from the information provided by the supplied StringTemplatePREVIEW instance.

For example:

StringProcessor processor = st -> st.interpolate().toUpperCase();
Implementation Note:
Implementations using StringProcessorPREVIEW are equivalent to implementations using TemplateProcessor<String> or ValidatingProcessor<String, RuntimeException>, however, StringProcessor is cleaner and easier to understand.
See Java Language Specification:
15.8.6 Process Template Expressions
See Also: