TemplateRuntime — 문자열 템플릿 부트스트랩 클래스
TemplateRuntime — 문자열 템플릿 부트스트랩 클래스
TemplateRuntime은 문자열 템플릿(string template) 부트스트랩 메서드를 관리해요. 이 메서드들은 예를 들어 자바 컴파일러 구현이 StringTemplatePREVIEW 인스턴스를 만들 때 사용할 수 있어요. 예를 들어 자바 컴파일러는 다음 코드를 변환해요:
int x = 10;
int y = 20;
StringTemplate st = RAW."\{x} + \{y} = \{x + y}";
본문
public static CallSite newStringTemplate(MethodHandles.Lookup lookup, String invocationName, MethodType invocationType, String... fragments) throws Throwable — 주어진 프래그먼트(fragment)들로 StringTemplate 인스턴스를 만드는 CallSite를 만들어요.
public static CallSite newLargeStringTemplate(MethodHandles.Lookup lookup, String invocationName, MethodType invocationType, String[] fragments) throws Throwable — 많은 수의 프래그먼트를 가진 문자열 템플릿을 만들 때 사용되는 CallSite를 만들어요.
public static CallSite processStringTemplate(MethodHandles.Lookup lookup, String invocationName, MethodType invocationType, MethodHandle processor...) throws Throwable — 문자열 템플릿이 프로세서(processor)로 처리될 때 사용되는 CallSite를 만들어요.
이 클래스는 문자열 템플릿(JEP 430)의 런타임 지원을 제공해요. RAW, STR, FMT 같은 프로세서와 함께 문자열 템플릿 표현식이 컴파일러에 의해 이 부트스트랩 메서드들을 사용해 변환돼요.