public final class Names extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CLASS_PREFIX |
static String |
INTERNAL_CLASS_PREFIX |
| Modifier and Type | Method and Description |
|---|---|
static String |
javaClassNameFromSoyTemplateName(String soyTemplate)
Translate a user controlled Soy name to a form that is safe to encode in a java class, method
or field name.
|
static String |
javaFileName(String soyNamespace,
String fileName)
Given the soy namespace and file name returns the path where the corresponding resource should
be stored.
|
static void |
rewriteStackTrace(Throwable throwable)
Rewrites the given stack trace by replacing all references to generated jbcsrc types with the
original template names.
|
static String |
soyTemplateNameFromJavaClassName(String javaClass)
Translates a Java class name generated by
javaClassNameFromSoyTemplateName(java.lang.String), back to
the original soy template name. |
public static final String CLASS_PREFIX
public static final String INTERNAL_CLASS_PREFIX
public static String javaClassNameFromSoyTemplateName(String soyTemplate)
Soy identifiers are very simple, they are restricted to the following regex: [a-zA-Z_]([a-zA-Z_0-9])*. So a template name is just one or more identifiers separated by
. characters. To escape it, we simply replace all '.'s with '_'s, and all '_'s with
'__' and prefix with a package name.
public static String javaFileName(String soyNamespace, String fileName)
public static String soyTemplateNameFromJavaClassName(String javaClass)
javaClassNameFromSoyTemplateName(java.lang.String), back to
the original soy template name.public static void rewriteStackTrace(Throwable throwable)