Package com.google.auto.value.processor
Class TemplateVars
java.lang.Object
com.google.auto.value.processor.TemplateVars
- Direct Known Subclasses:
AutoAnnotationTemplateVars
,AutoValueOrOneOfTemplateVars
,GwtSerialization.GwtTemplateVars
A template and a set of variables to be substituted into that template. A concrete subclass of
this class defines a set of fields that are template variables, and an implementation of the
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 may be a direct subclass of this class or a more distant descendant. Every field in the starting class and its ancestors up to this class will be included. 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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
addFields
(com.google.common.collect.ImmutableList.Builder<Field> fieldsBuilder, Field[] declaredFields) private static Object
fieldValue
(Field field, Object container) private static com.google.common.collect.ImmutableList
<Field> private static InputStream
inputStreamFromFile
(URL resourceUrl) private static InputStream
inputStreamFromJar
(URL resourceUrl) private static boolean
isStaticFinal
(Field field) (package private) abstract Template
(package private) static Template
parsedTemplateForResource
(String resourceName) private static Reader
readerFromResource
(String resourceName) private static Reader
readerFromUrl
(String resourceName) private static Template
retryParseAfterException
(String resourceName, Exception exception) (package private) 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 byparsedTemplate()
.toVars()
-
Field Details
-
fields
-
-
Constructor Details
-
TemplateVars
TemplateVars()
-
-
Method Details
-
parsedTemplate
-
getFields
-
addFields
-
toText
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 byparsedTemplate()
. -
toVars
-
parsedTemplateForResource
-
retryParseAfterException
-
readerFromResource
-
readerFromUrl
- Throws:
IOException
-
inputStreamFromJar
private static InputStream inputStreamFromJar(URL resourceUrl) throws URISyntaxException, IOException - Throws:
URISyntaxException
IOException
-
inputStreamFromFile
private static InputStream inputStreamFromFile(URL resourceUrl) throws IOException, URISyntaxException - Throws:
IOException
URISyntaxException
-
fieldValue
-
isStaticFinal
-