• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.auto.value.processor;
17 
18 import com.google.common.collect.ImmutableList;
19 
20 /**
21  * The variables to substitute into the autovalue.vm, autooneof.vm, or builder.vm templates.
22  *
23  * @author emcmanus@google.com (Éamonn McManus)
24  */
25 @SuppressWarnings("unused") // the fields in this class are only read via reflection
26 abstract class AutoValueishTemplateVars extends TemplateVars {
27   /** Whether to generate an equals(Object) method. */
28   Boolean equals;
29 
30   /** Whether to generate a hashCode() method. */
31   Boolean hashCode;
32 
33   /** Whether to generate a toString() method. */
34   Boolean toString;
35 
36   /**
37    * A string representing the parameter type declaration of the equals(Object) method, including
38    * any annotations. If {@link #equals} is false, this field is ignored (but it must still be
39    * non-null).
40    */
41   String equalsParameterType;
42 
43   /** The encoding of the {@code Generated} class. Empty if the class is not available. */
44   String generated;
45 
46   /** The package of the class with the {@code @AutoValue} annotation and its generated subclass. */
47   String pkg;
48 
49   /**
50    * The name of the class with the {@code @AutoValue} annotation, including containing classes but
51    * not including the package name.
52    */
53   String origClass;
54 
55   /** The simple name of the class with the {@code @AutoValue} annotation. */
56   String simpleClassName;
57 
58   /**
59    * The full spelling of any annotations to add to this class, or an empty list if there are none.
60    * A non-empty value might look something like {@code
61    * "@`com.google.common.annotations.GwtCompatible`(serializable = true)"}. The {@code ``} marks
62    * are explained in {@link TypeEncoder}.
63    */
64   ImmutableList<String> annotations;
65 
66   /**
67    * The formal generic signature of the class with the {@code @AutoValue} or {@code AutoOneOf}
68    * annotation and any generated subclass. This is empty, or contains type variables with optional
69    * bounds, for example {@code <K, V extends K>}.
70    */
71   String formalTypes;
72 
73   /**
74    * The generic signature used by any generated subclass for its superclass reference. This is
75    * empty, or contains only type variables with no bounds, for example {@code <K, V>}.
76    */
77   String actualTypes;
78 
79   /**
80    * The generic signature in {@link #actualTypes} where every variable has been replaced by a
81    * wildcard, for example {@code <?, ?>}.
82    */
83   String wildcardTypes;
84 
85   /**
86    * The text of the complete serialVersionUID declaration, or empty if there is none. When
87    * non-empty, it will be something like {@code private static final long serialVersionUID =
88    * 123L;}.
89    */
90   String serialVersionUID;
91 }
92