abstract class TemplateVars
extends java.lang.Object
parsedTemplate()
method which is the template to substitute them into. Once the values
of the fields have been assigned, the toText()
method returns the result of substituting
them into the template.
The subclass must be a direct subclass of this class. Fields cannot be static unless they are also final. They cannot be private, though they can be package-private if the class is in the same package as this class. They cannot be primitive or null, so that there is a clear indication when a field has not been set.
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.ImmutableList<java.lang.reflect.Field> |
fields |
Constructor and Description |
---|
TemplateVars() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.Object |
fieldValue(java.lang.reflect.Field field,
java.lang.Object container) |
private static boolean |
isStaticFinal(java.lang.reflect.Field field) |
(package private) abstract Template |
parsedTemplate() |
(package private) static Template |
parsedTemplateForResource(java.lang.String resourceName) |
private static Template |
parsedTemplateFromFile(java.net.URL resourceUrl) |
private static Template |
parsedTemplateFromJar(java.net.URL resourceUrl) |
private static Template |
parsedTemplateFromUrl(java.lang.String resourceName) |
private static Template |
retryParseAfterException(java.lang.String resourceName,
java.lang.Exception exception) |
private static Template |
templateFromInputStream(java.io.InputStream in) |
(package private) java.lang.String |
toText()
Returns the result of substituting the variables defined by the fields of this class
(a concrete subclass of TemplateVars) into the template returned by
parsedTemplate() . |
private java.util.Map<java.lang.String,java.lang.Object> |
toVars() |
private final com.google.common.collect.ImmutableList<java.lang.reflect.Field> fields
abstract Template parsedTemplate()
java.lang.String toText()
parsedTemplate()
.private java.util.Map<java.lang.String,java.lang.Object> toVars()
static Template parsedTemplateForResource(java.lang.String resourceName)
private static Template retryParseAfterException(java.lang.String resourceName, java.lang.Exception exception)
private static Template templateFromInputStream(java.io.InputStream in) throws java.io.UnsupportedEncodingException, java.io.IOException
java.io.UnsupportedEncodingException
java.io.IOException
private static Template parsedTemplateFromUrl(java.lang.String resourceName) throws java.net.URISyntaxException, java.io.IOException
java.net.URISyntaxException
java.io.IOException
private static Template parsedTemplateFromJar(java.net.URL resourceUrl) throws java.net.URISyntaxException, java.io.IOException
java.net.URISyntaxException
java.io.IOException
private static Template parsedTemplateFromFile(java.net.URL resourceUrl) throws java.io.IOException, java.net.URISyntaxException
java.io.IOException
java.net.URISyntaxException
private static java.lang.Object fieldValue(java.lang.reflect.Field field, java.lang.Object container)
private static boolean isStaticFinal(java.lang.reflect.Field field)