Skip to content

Commit bdb4a60

Browse files
style(internal): reduce verbosity of identity methods (#10)
1 parent a745b44 commit bdb4a60

File tree

100 files changed

+787
-1258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+787
-1258
lines changed

openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ private constructor(
2424
return true
2525
}
2626

27-
return /* spotless:off */ other is OpenAIError && this.additionalProperties == other.additionalProperties /* spotless:on */
27+
return /* spotless:off */ other is OpenAIError && additionalProperties == other.additionalProperties /* spotless:on */
2828
}
2929

30-
override fun hashCode(): Int {
31-
return /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */
32-
}
30+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */
3331

3432
override fun toString() = "OpenAIError{additionalProperties=$additionalProperties}"
3533

openai-java-core/src/main/kotlin/com/openai/models/Batch.kt

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ private constructor(
471471
return true
472472
}
473473

474-
return /* spotless:off */ other is Object && this.value == other.value /* spotless:on */
474+
return /* spotless:off */ other is Object && value == other.value /* spotless:on */
475475
}
476476

477477
override fun hashCode() = value.hashCode()
@@ -522,7 +522,7 @@ private constructor(
522522
return true
523523
}
524524

525-
return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */
525+
return /* spotless:off */ other is Status && value == other.value /* spotless:on */
526526
}
527527

528528
override fun hashCode() = value.hashCode()
@@ -696,17 +696,14 @@ private constructor(
696696
return true
697697
}
698698

699-
return /* spotless:off */ other is Errors && this.object_ == other.object_ && this.data == other.data && this.additionalProperties == other.additionalProperties /* spotless:on */
699+
return /* spotless:off */ other is Errors && object_ == other.object_ && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */
700700
}
701701

702-
private var hashCode: Int = 0
702+
/* spotless:off */
703+
private val hashCode: Int by lazy { Objects.hash(object_, data, additionalProperties) }
704+
/* spotless:on */
703705

704-
override fun hashCode(): Int {
705-
if (hashCode == 0) {
706-
hashCode = /* spotless:off */ Objects.hash(object_, data, additionalProperties) /* spotless:on */
707-
}
708-
return hashCode
709-
}
706+
override fun hashCode(): Int = hashCode
710707

711708
override fun toString() =
712709
"Errors{object_=$object_, data=$data, additionalProperties=$additionalProperties}"
@@ -717,17 +714,14 @@ private constructor(
717714
return true
718715
}
719716

720-
return /* spotless:off */ other is Batch && this.id == other.id && this.object_ == other.object_ && this.endpoint == other.endpoint && this.errors == other.errors && this.inputFileId == other.inputFileId && this.completionWindow == other.completionWindow && this.status == other.status && this.outputFileId == other.outputFileId && this.errorFileId == other.errorFileId && this.createdAt == other.createdAt && this.inProgressAt == other.inProgressAt && this.expiresAt == other.expiresAt && this.finalizingAt == other.finalizingAt && this.completedAt == other.completedAt && this.failedAt == other.failedAt && this.expiredAt == other.expiredAt && this.cancellingAt == other.cancellingAt && this.cancelledAt == other.cancelledAt && this.requestCounts == other.requestCounts && this.metadata == other.metadata && this.additionalProperties == other.additionalProperties /* spotless:on */
717+
return /* spotless:off */ other is Batch && id == other.id && object_ == other.object_ && endpoint == other.endpoint && errors == other.errors && inputFileId == other.inputFileId && completionWindow == other.completionWindow && status == other.status && outputFileId == other.outputFileId && errorFileId == other.errorFileId && createdAt == other.createdAt && inProgressAt == other.inProgressAt && expiresAt == other.expiresAt && finalizingAt == other.finalizingAt && completedAt == other.completedAt && failedAt == other.failedAt && expiredAt == other.expiredAt && cancellingAt == other.cancellingAt && cancelledAt == other.cancelledAt && requestCounts == other.requestCounts && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
721718
}
722719

723-
private var hashCode: Int = 0
720+
/* spotless:off */
721+
private val hashCode: Int by lazy { Objects.hash(id, object_, endpoint, errors, inputFileId, completionWindow, status, outputFileId, errorFileId, createdAt, inProgressAt, expiresAt, finalizingAt, completedAt, failedAt, expiredAt, cancellingAt, cancelledAt, requestCounts, metadata, additionalProperties) }
722+
/* spotless:on */
724723

725-
override fun hashCode(): Int {
726-
if (hashCode == 0) {
727-
hashCode = /* spotless:off */ Objects.hash(id, object_, endpoint, errors, inputFileId, completionWindow, status, outputFileId, errorFileId, createdAt, inProgressAt, expiresAt, finalizingAt, completedAt, failedAt, expiredAt, cancellingAt, cancelledAt, requestCounts, metadata, additionalProperties) /* spotless:on */
728-
}
729-
return hashCode
730-
}
724+
override fun hashCode(): Int = hashCode
731725

732726
override fun toString() =
733727
"Batch{id=$id, object_=$object_, endpoint=$endpoint, errors=$errors, inputFileId=$inputFileId, completionWindow=$completionWindow, status=$status, outputFileId=$outputFileId, errorFileId=$errorFileId, createdAt=$createdAt, inProgressAt=$inProgressAt, expiresAt=$expiresAt, finalizingAt=$finalizingAt, completedAt=$completedAt, failedAt=$failedAt, expiredAt=$expiredAt, cancellingAt=$cancellingAt, cancelledAt=$cancelledAt, requestCounts=$requestCounts, metadata=$metadata, additionalProperties=$additionalProperties}"

openai-java-core/src/main/kotlin/com/openai/models/BatchCancelParams.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,10 @@ constructor(
4848
return true
4949
}
5050

51-
return /* spotless:off */ other is BatchCancelParams && this.batchId == other.batchId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
51+
return /* spotless:off */ other is BatchCancelParams && batchId == other.batchId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
5252
}
5353

54-
override fun hashCode(): Int {
55-
return /* spotless:off */ Objects.hash(batchId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
56-
}
54+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(batchId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
5755

5856
override fun toString() =
5957
"BatchCancelParams{batchId=$batchId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}"

openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,14 @@ constructor(
191191
return true
192192
}
193193

194-
return /* spotless:off */ other is BatchCreateBody && this.completionWindow == other.completionWindow && this.endpoint == other.endpoint && this.inputFileId == other.inputFileId && this.metadata == other.metadata && this.additionalProperties == other.additionalProperties /* spotless:on */
194+
return /* spotless:off */ other is BatchCreateBody && completionWindow == other.completionWindow && endpoint == other.endpoint && inputFileId == other.inputFileId && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
195195
}
196196

197-
private var hashCode: Int = 0
197+
/* spotless:off */
198+
private val hashCode: Int by lazy { Objects.hash(completionWindow, endpoint, inputFileId, metadata, additionalProperties) }
199+
/* spotless:on */
198200

199-
override fun hashCode(): Int {
200-
if (hashCode == 0) {
201-
hashCode = /* spotless:off */ Objects.hash(completionWindow, endpoint, inputFileId, metadata, additionalProperties) /* spotless:on */
202-
}
203-
return hashCode
204-
}
201+
override fun hashCode(): Int = hashCode
205202

206203
override fun toString() =
207204
"BatchCreateBody{completionWindow=$completionWindow, endpoint=$endpoint, inputFileId=$inputFileId, metadata=$metadata, additionalProperties=$additionalProperties}"
@@ -218,12 +215,10 @@ constructor(
218215
return true
219216
}
220217

221-
return /* spotless:off */ other is BatchCreateParams && this.completionWindow == other.completionWindow && this.endpoint == other.endpoint && this.inputFileId == other.inputFileId && this.metadata == other.metadata && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
218+
return /* spotless:off */ other is BatchCreateParams && completionWindow == other.completionWindow && endpoint == other.endpoint && inputFileId == other.inputFileId && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
222219
}
223220

224-
override fun hashCode(): Int {
225-
return /* spotless:off */ Objects.hash(completionWindow, endpoint, inputFileId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
226-
}
221+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(completionWindow, endpoint, inputFileId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
227222

228223
override fun toString() =
229224
"BatchCreateParams{completionWindow=$completionWindow, endpoint=$endpoint, inputFileId=$inputFileId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}"
@@ -434,7 +429,7 @@ constructor(
434429
return true
435430
}
436431

437-
return /* spotless:off */ other is CompletionWindow && this.value == other.value /* spotless:on */
432+
return /* spotless:off */ other is CompletionWindow && value == other.value /* spotless:on */
438433
}
439434

440435
override fun hashCode() = value.hashCode()
@@ -485,7 +480,7 @@ constructor(
485480
return true
486481
}
487482

488-
return /* spotless:off */ other is Endpoint && this.value == other.value /* spotless:on */
483+
return /* spotless:off */ other is Endpoint && value == other.value /* spotless:on */
489484
}
490485

491486
override fun hashCode() = value.hashCode()
@@ -585,17 +580,14 @@ constructor(
585580
return true
586581
}
587582

588-
return /* spotless:off */ other is Metadata && this.additionalProperties == other.additionalProperties /* spotless:on */
583+
return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */
589584
}
590585

591-
private var hashCode: Int = 0
586+
/* spotless:off */
587+
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
588+
/* spotless:on */
592589

593-
override fun hashCode(): Int {
594-
if (hashCode == 0) {
595-
hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */
596-
}
597-
return hashCode
598-
}
590+
override fun hashCode(): Int = hashCode
599591

600592
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
601593
}

openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,14 @@ private constructor(
151151
return true
152152
}
153153

154-
return /* spotless:off */ other is BatchError && this.code == other.code && this.message == other.message && this.param == other.param && this.line == other.line && this.additionalProperties == other.additionalProperties /* spotless:on */
154+
return /* spotless:off */ other is BatchError && code == other.code && message == other.message && param == other.param && line == other.line && additionalProperties == other.additionalProperties /* spotless:on */
155155
}
156156

157-
private var hashCode: Int = 0
157+
/* spotless:off */
158+
private val hashCode: Int by lazy { Objects.hash(code, message, param, line, additionalProperties) }
159+
/* spotless:on */
158160

159-
override fun hashCode(): Int {
160-
if (hashCode == 0) {
161-
hashCode = /* spotless:off */ Objects.hash(code, message, param, line, additionalProperties) /* spotless:on */
162-
}
163-
return hashCode
164-
}
161+
override fun hashCode(): Int = hashCode
165162

166163
override fun toString() =
167164
"BatchError{code=$code, message=$message, param=$param, line=$line, additionalProperties=$additionalProperties}"

openai-java-core/src/main/kotlin/com/openai/models/BatchListPage.kt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ private constructor(
3434
return true
3535
}
3636

37-
return /* spotless:off */ other is BatchListPage && this.batchesService == other.batchesService && this.params == other.params && this.response == other.response /* spotless:on */
37+
return /* spotless:off */ other is BatchListPage && batchesService == other.batchesService && params == other.params && response == other.response /* spotless:on */
3838
}
3939

40-
override fun hashCode(): Int {
41-
return /* spotless:off */ Objects.hash(batchesService, params, response) /* spotless:on */
42-
}
40+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(batchesService, params, response) /* spotless:on */
4341

4442
override fun toString() =
4543
"BatchListPage{batchesService=$batchesService, params=$params, response=$response}"
@@ -106,15 +104,12 @@ private constructor(
106104
return true
107105
}
108106

109-
return /* spotless:off */ other is Response && this.data == other.data && this.additionalProperties == other.additionalProperties /* spotless:on */
107+
return /* spotless:off */ other is Response && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */
110108
}
111109

112-
override fun hashCode(): Int {
113-
return /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */
114-
}
110+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */
115111

116-
override fun toString() =
117-
"BatchListPage.Response{data=$data, additionalProperties=$additionalProperties}"
112+
override fun toString() = "Response{data=$data, additionalProperties=$additionalProperties}"
118113

119114
companion object {
120115

openai-java-core/src/main/kotlin/com/openai/models/BatchListPageAsync.kt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ private constructor(
3535
return true
3636
}
3737

38-
return /* spotless:off */ other is BatchListPageAsync && this.batchesService == other.batchesService && this.params == other.params && this.response == other.response /* spotless:on */
38+
return /* spotless:off */ other is BatchListPageAsync && batchesService == other.batchesService && params == other.params && response == other.response /* spotless:on */
3939
}
4040

41-
override fun hashCode(): Int {
42-
return /* spotless:off */ Objects.hash(batchesService, params, response) /* spotless:on */
43-
}
41+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(batchesService, params, response) /* spotless:on */
4442

4543
override fun toString() =
4644
"BatchListPageAsync{batchesService=$batchesService, params=$params, response=$response}"
@@ -109,15 +107,12 @@ private constructor(
109107
return true
110108
}
111109

112-
return /* spotless:off */ other is Response && this.data == other.data && this.additionalProperties == other.additionalProperties /* spotless:on */
110+
return /* spotless:off */ other is Response && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */
113111
}
114112

115-
override fun hashCode(): Int {
116-
return /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */
117-
}
113+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */
118114

119-
override fun toString() =
120-
"BatchListPageAsync.Response{data=$data, additionalProperties=$additionalProperties}"
115+
override fun toString() = "Response{data=$data, additionalProperties=$additionalProperties}"
121116

122117
companion object {
123118

openai-java-core/src/main/kotlin/com/openai/models/BatchListParams.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ constructor(
4141
return true
4242
}
4343

44-
return /* spotless:off */ other is BatchListParams && this.after == other.after && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */
44+
return /* spotless:off */ other is BatchListParams && after == other.after && limit == other.limit && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
4545
}
4646

47-
override fun hashCode(): Int {
48-
return /* spotless:off */ Objects.hash(after, limit, additionalHeaders, additionalQueryParams) /* spotless:on */
49-
}
47+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(after, limit, additionalHeaders, additionalQueryParams) /* spotless:on */
5048

5149
override fun toString() =
5250
"BatchListParams{after=$after, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"

openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,14 @@ private constructor(
132132
return true
133133
}
134134

135-
return /* spotless:off */ other is BatchRequestCounts && this.total == other.total && this.completed == other.completed && this.failed == other.failed && this.additionalProperties == other.additionalProperties /* spotless:on */
135+
return /* spotless:off */ other is BatchRequestCounts && total == other.total && completed == other.completed && failed == other.failed && additionalProperties == other.additionalProperties /* spotless:on */
136136
}
137137

138-
private var hashCode: Int = 0
138+
/* spotless:off */
139+
private val hashCode: Int by lazy { Objects.hash(total, completed, failed, additionalProperties) }
140+
/* spotless:on */
139141

140-
override fun hashCode(): Int {
141-
if (hashCode == 0) {
142-
hashCode = /* spotless:off */ Objects.hash(total, completed, failed, additionalProperties) /* spotless:on */
143-
}
144-
return hashCode
145-
}
142+
override fun hashCode(): Int = hashCode
146143

147144
override fun toString() =
148145
"BatchRequestCounts{total=$total, completed=$completed, failed=$failed, additionalProperties=$additionalProperties}"

openai-java-core/src/main/kotlin/com/openai/models/BatchRetrieveParams.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ constructor(
3737
return true
3838
}
3939

40-
return /* spotless:off */ other is BatchRetrieveParams && this.batchId == other.batchId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */
40+
return /* spotless:off */ other is BatchRetrieveParams && batchId == other.batchId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
4141
}
4242

43-
override fun hashCode(): Int {
44-
return /* spotless:off */ Objects.hash(batchId, additionalHeaders, additionalQueryParams) /* spotless:on */
45-
}
43+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(batchId, additionalHeaders, additionalQueryParams) /* spotless:on */
4644

4745
override fun toString() =
4846
"BatchRetrieveParams{batchId=$batchId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"

0 commit comments

Comments
 (0)