1616import com .google .gson .JsonObject ;
1717import com .google .gson .TypeAdapter ;
1818import com .google .gson .TypeAdapterFactory ;
19- import com .google .gson .annotations .JsonAdapter ;
2019import com .google .gson .annotations .SerializedName ;
2120import com .google .gson .reflect .TypeToken ;
2221import com .google .gson .stream .JsonReader ;
3029
3130/** AudienceDefinition */
3231public class AudienceDefinition {
33- /**
34- * The underlying data type being segmented for this audience. Possible values: users, accounts.
35- */
36- @ JsonAdapter (TypeEnum .Adapter .class )
37- public enum TypeEnum {
38- ACCOUNTS ("ACCOUNTS" ),
39-
40- USERS ("USERS" );
41-
42- private String value ;
43-
44- TypeEnum (String value ) {
45- this .value = value ;
46- }
47-
48- public String getValue () {
49- return value ;
50- }
51-
52- @ Override
53- public String toString () {
54- return String .valueOf (value );
55- }
56-
57- public static TypeEnum fromValue (String value ) {
58- for (TypeEnum b : TypeEnum .values ()) {
59- if (b .value .equals (value )) {
60- return b ;
61- }
62- }
63- throw new IllegalArgumentException ("Unexpected value '" + value + "'" );
64- }
65-
66- public static class Adapter extends TypeAdapter <TypeEnum > {
67- @ Override
68- public void write (final JsonWriter jsonWriter , final TypeEnum enumeration )
69- throws IOException {
70- jsonWriter .value (enumeration .getValue ());
71- }
72-
73- @ Override
74- public TypeEnum read (final JsonReader jsonReader ) throws IOException {
75- String value = jsonReader .nextString ();
76- return TypeEnum .fromValue (value );
77- }
78- }
79- }
80-
81- public static final String SERIALIZED_NAME_TYPE = "type" ;
82-
83- @ SerializedName (SERIALIZED_NAME_TYPE )
84- private TypeEnum type ;
85-
8632 public static final String SERIALIZED_NAME_QUERY = "query" ;
8733
8834 @ SerializedName (SERIALIZED_NAME_QUERY )
@@ -95,26 +41,6 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException {
9541
9642 public AudienceDefinition () {}
9743
98- public AudienceDefinition type (TypeEnum type ) {
99-
100- this .type = type ;
101- return this ;
102- }
103-
104- /**
105- * The underlying data type being segmented for this audience. Possible values: users, accounts.
106- *
107- * @return type
108- */
109- @ javax .annotation .Nullable
110- public TypeEnum getType () {
111- return type ;
112- }
113-
114- public void setType (TypeEnum type ) {
115- this .type = type ;
116- }
117-
11844 public AudienceDefinition query (String query ) {
11945
12046 this .query = query ;
@@ -166,21 +92,19 @@ public boolean equals(Object o) {
16692 return false ;
16793 }
16894 AudienceDefinition audienceDefinition = (AudienceDefinition ) o ;
169- return Objects .equals (this .type , audienceDefinition .type )
170- && Objects .equals (this .query , audienceDefinition .query )
95+ return Objects .equals (this .query , audienceDefinition .query )
17196 && Objects .equals (this .targetEntity , audienceDefinition .targetEntity );
17297 }
17398
17499 @ Override
175100 public int hashCode () {
176- return Objects .hash (type , query , targetEntity );
101+ return Objects .hash (query , targetEntity );
177102 }
178103
179104 @ Override
180105 public String toString () {
181106 StringBuilder sb = new StringBuilder ();
182107 sb .append ("class AudienceDefinition {\n " );
183- sb .append (" type: " ).append (toIndentedString (type )).append ("\n " );
184108 sb .append (" query: " ).append (toIndentedString (query )).append ("\n " );
185109 sb .append (" targetEntity: " ).append (toIndentedString (targetEntity )).append ("\n " );
186110 sb .append ("}" );
@@ -204,7 +128,6 @@ private String toIndentedString(Object o) {
204128 static {
205129 // a set of all properties/fields (JSON key names)
206130 openapiFields = new HashSet <String >();
207- openapiFields .add ("type" );
208131 openapiFields .add ("query" );
209132 openapiFields .add ("targetEntity" );
210133
@@ -253,14 +176,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
253176 }
254177 }
255178 JsonObject jsonObj = jsonElement .getAsJsonObject ();
256- if ((jsonObj .get ("type" ) != null && !jsonObj .get ("type" ).isJsonNull ())
257- && !jsonObj .get ("type" ).isJsonPrimitive ()) {
258- throw new IllegalArgumentException (
259- String .format (
260- "Expected the field `type` to be a primitive type in the JSON string"
261- + " but got `%s`" ,
262- jsonObj .get ("type" ).toString ()));
263- }
264179 if (!jsonObj .get ("query" ).isJsonPrimitive ()) {
265180 throw new IllegalArgumentException (
266181 String .format (
0 commit comments