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 voidaddFields(com.google.common.collect.ImmutableList.Builder<Field> fieldsBuilder, Field[] declaredFields) private static ObjectfieldValue(Field field, Object container) private static com.google.common.collect.ImmutableList<Field> private static InputStreaminputStreamFromFile(URL resourceUrl) private static InputStreaminputStreamFromJar(URL resourceUrl) private static booleanisStaticFinal(Field field) (package private) abstract Template(package private) static TemplateparsedTemplateForResource(String resourceName) private static ReaderreaderFromResource(String resourceName) private static ReaderreaderFromUrl(String resourceName) private static TemplateretryParseAfterException(String resourceName, Exception exception) (package private) StringtoText()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:
URISyntaxExceptionIOException
-
inputStreamFromFile
private static InputStream inputStreamFromFile(URL resourceUrl) throws IOException, URISyntaxException - Throws:
IOExceptionURISyntaxException
-
fieldValue
-
isStaticFinal
-