99import com .fasterxml .jackson .annotation .JsonInclude ;
1010import com .fasterxml .jackson .annotation .JsonProperty ;
1111import com .fasterxml .jackson .annotation .JsonSetter ;
12+ import com .fasterxml .jackson .annotation .Nulls ;
1213import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
1314import com .flagright .api .core .ObjectMappers ;
1415import java .util .HashMap ;
1516import java .util .Map ;
1617import java .util .Objects ;
18+ import java .util .Optional ;
1719import org .jetbrains .annotations .NotNull ;
1820
1921@ JsonInclude (JsonInclude .Include .NON_ABSENT )
@@ -23,11 +25,15 @@ public final class CustomColumn {
2325
2426 private final ColumnType type ;
2527
28+ private final Optional <Boolean > primaryKey ;
29+
2630 private final Map <String , Object > additionalProperties ;
2731
28- private CustomColumn (String key , ColumnType type , Map <String , Object > additionalProperties ) {
32+ private CustomColumn (
33+ String key , ColumnType type , Optional <Boolean > primaryKey , Map <String , Object > additionalProperties ) {
2934 this .key = key ;
3035 this .type = type ;
36+ this .primaryKey = primaryKey ;
3137 this .additionalProperties = additionalProperties ;
3238 }
3339
@@ -41,6 +47,11 @@ public ColumnType getType() {
4147 return type ;
4248 }
4349
50+ @ JsonProperty ("primaryKey" )
51+ public Optional <Boolean > getPrimaryKey () {
52+ return primaryKey ;
53+ }
54+
4455 @ java .lang .Override
4556 public boolean equals (Object other ) {
4657 if (this == other ) return true ;
@@ -53,12 +64,12 @@ public Map<String, Object> getAdditionalProperties() {
5364 }
5465
5566 private boolean equalTo (CustomColumn other ) {
56- return key .equals (other .key ) && type .equals (other .type );
67+ return key .equals (other .key ) && type .equals (other .type ) && primaryKey . equals ( other . primaryKey ) ;
5768 }
5869
5970 @ java .lang .Override
6071 public int hashCode () {
61- return Objects .hash (this .key , this .type );
72+ return Objects .hash (this .key , this .type , this . primaryKey );
6273 }
6374
6475 @ java .lang .Override
@@ -82,6 +93,10 @@ public interface TypeStage {
8293
8394 public interface _FinalStage {
8495 CustomColumn build ();
96+
97+ _FinalStage primaryKey (Optional <Boolean > primaryKey );
98+
99+ _FinalStage primaryKey (Boolean primaryKey );
85100 }
86101
87102 @ JsonIgnoreProperties (ignoreUnknown = true )
@@ -90,6 +105,8 @@ public static final class Builder implements KeyStage, TypeStage, _FinalStage {
90105
91106 private ColumnType type ;
92107
108+ private Optional <Boolean > primaryKey = Optional .empty ();
109+
93110 @ JsonAnySetter
94111 private Map <String , Object > additionalProperties = new HashMap <>();
95112
@@ -99,6 +116,7 @@ private Builder() {}
99116 public Builder from (CustomColumn other ) {
100117 key (other .getKey ());
101118 type (other .getType ());
119+ primaryKey (other .getPrimaryKey ());
102120 return this ;
103121 }
104122
@@ -116,9 +134,22 @@ public _FinalStage type(@NotNull ColumnType type) {
116134 return this ;
117135 }
118136
137+ @ java .lang .Override
138+ public _FinalStage primaryKey (Boolean primaryKey ) {
139+ this .primaryKey = Optional .ofNullable (primaryKey );
140+ return this ;
141+ }
142+
143+ @ java .lang .Override
144+ @ JsonSetter (value = "primaryKey" , nulls = Nulls .SKIP )
145+ public _FinalStage primaryKey (Optional <Boolean > primaryKey ) {
146+ this .primaryKey = primaryKey ;
147+ return this ;
148+ }
149+
119150 @ java .lang .Override
120151 public CustomColumn build () {
121- return new CustomColumn (key , type , additionalProperties );
152+ return new CustomColumn (key , type , primaryKey , additionalProperties );
122153 }
123154 }
124155}
0 commit comments