Top Description Fields Constructors Methods
com.google.auto.value.processor

pack-priv abstract Class TemplateVars

extends Object
Class Inheritance
Known Direct Subclasses
com.google.auto.value.processor.AutoAnnotationTemplateVars, com.google.auto.value.processor.AutoBuilderAnnotationTemplateVars, com.google.auto.value.processor.AutoValueishTemplateVars, com.google.auto.value.processor.GwtSerialization.GwtTemplateVars
Static Imports
java.nio.charset.StandardCharsets.UTF_8

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.

Author
Éamonn McManus

Field Summary

Modifier and TypeField and Description
private final ImmutableList<Field>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static void
addFields(ImmutableList.Builder<Field> fieldsBuilder, Field[] declaredFields)

private static Object
fieldValue(Field field, Object container)

private static ImmutableList<Field>
private static boolean
pack-priv abstract Template
pack-priv static Template
private static Reader
readerFromFile(URL resourceUrl)

private static Reader
readerFromJar(URL resourceUrl)

private static Reader
readerFromUrl(String resourceName)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv 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 ImmutableMap<String, Object>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

fieldsback to summary
private final ImmutableList<Field> fields

Constructor Detail

TemplateVarsback to summary
pack-priv TemplateVars()

Method Detail

addFieldsback to summary
private static void addFields(ImmutableList.Builder<Field> fieldsBuilder, Field[] declaredFields)
fieldValueback to summary
private static Object fieldValue(Field field, Object container)
getFieldsback to summary
private static ImmutableList<Field> getFields(Class<?> c)
isStaticFinalback to summary
private static boolean isStaticFinal(Field field)
parsedTemplateback to summary
pack-priv abstract Template parsedTemplate()
parsedTemplateForResourceback to summary
pack-priv static Template parsedTemplateForResource(String resourceName)
readerFromFileback to summary
private static Reader readerFromFile(URL resourceUrl) throws IOException, URISyntaxException
readerFromJarback to summary
private static Reader readerFromJar(URL resourceUrl) throws URISyntaxException, IOException
readerFromUrlback to summary
private static Reader readerFromUrl(String resourceName) throws IOException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
toTextback to summary
pack-priv 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().

toVarsback to summary
private ImmutableMap<String, Object> toVars()