From 7511827b9f683885f4b25cc33c0c1706e9aa51eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Thu, 19 Feb 2026 12:40:33 +0100 Subject: [PATCH] chore: remove unnecessary builders for type aliases --- .../generator/additional_properties_test.go | 73 +++++++++++++++++++ codegen/internal/generator/model.go | 15 +++- codegen/internal/generator/render.go | 1 + .../internal/generator/templates/model.tmpl | 2 + codegen/internal/generator/types.go | 4 +- .../java/com/sumup/sdk/models/Attributes.java | 38 +--------- .../com/sumup/sdk/models/BusinessOwners.java | 38 +--------- .../com/sumup/sdk/models/ChangeStatus.java | 38 +--------- .../com/sumup/sdk/models/CheckoutSuccess.java | 38 +--------- .../sumup/sdk/models/CompanyIdentifiers.java | 38 +--------- .../com/sumup/sdk/models/CountryCode.java | 38 +--------- .../com/sumup/sdk/models/ErrorExtended.java | 38 +--------- .../java/com/sumup/sdk/models/EventId.java | 38 +--------- .../sumup/sdk/models/FinancialPayouts.java | 38 +--------- .../sumup/sdk/models/HorizontalAccuracy.java | 38 +--------- src/main/java/com/sumup/sdk/models/Lat.java | 38 +--------- .../java/com/sumup/sdk/models/LegalType.java | 38 +--------- .../java/com/sumup/sdk/models/LinkRefund.java | 38 +--------- src/main/java/com/sumup/sdk/models/Lon.java | 38 +--------- .../java/com/sumup/sdk/models/Merchant.java | 38 +--------- src/main/java/com/sumup/sdk/models/Meta.java | 38 +--------- .../java/com/sumup/sdk/models/Metadata.java | 38 +--------- .../java/com/sumup/sdk/models/Person.java | 38 +--------- .../com/sumup/sdk/models/PhoneNumber.java | 38 +--------- .../java/com/sumup/sdk/models/ReaderId.java | 38 +--------- .../java/com/sumup/sdk/models/ReaderName.java | 38 +--------- .../sumup/sdk/models/ReaderPairingCode.java | 38 +--------- .../com/sumup/sdk/models/ResourceType.java | 38 +--------- .../com/sumup/sdk/models/TransactionFull.java | 38 +--------- .../sumup/sdk/models/TransactionHistory.java | 38 +--------- .../com/sumup/sdk/models/TransactionId.java | 38 +--------- .../java/com/sumup/sdk/models/Version.java | 38 +--------- 32 files changed, 120 insertions(+), 1001 deletions(-) diff --git a/codegen/internal/generator/additional_properties_test.go b/codegen/internal/generator/additional_properties_test.go index a9637f5..37c4e6c 100644 --- a/codegen/internal/generator/additional_properties_test.go +++ b/codegen/internal/generator/additional_properties_test.go @@ -65,9 +65,82 @@ func TestGenerateModelWithPropertiesAndAdditionalProperties(t *testing.T) { assertContains(t, generated, "public Builder additionalProperty(String name, Object value)") } +func TestGenerateModelWithoutBuilderForTypeAliases(t *testing.T) { + t.Parallel() + + tmp := t.TempDir() + specPath := filepath.Join(tmp, "openapi.json") + outputDir := filepath.Join(tmp, "src", "main", "java") + resourceDir := filepath.Join(tmp, "src", "main", "resources") + + spec := `{ + "openapi": "3.0.3", + "info": { + "title": "test", + "version": "1.0.0" + }, + "paths": {}, + "components": { + "schemas": { + "Lon": { + "type": "number", + "format": "float" + }, + "Meta": { + "type": "object" + } + } + } +}` + if err := os.WriteFile(specPath, []byte(spec), 0o644); err != nil { + t.Fatalf("write spec: %v", err) + } + + params := Params{ + SpecPath: specPath, + OutputDir: outputDir, + ResourceDir: resourceDir, + BasePackage: "com.test.sdk", + } + if err := Run(context.Background(), params); err != nil { + t.Fatalf("run generator: %v", err) + } + + lonPath := filepath.Join(outputDir, "com", "test", "sdk", "models", "Lon.java") + lonContent, err := os.ReadFile(lonPath) + if err != nil { + t.Fatalf("read generated Lon model: %v", err) + } + lonGenerated := string(lonContent) + + assertContains(t, lonGenerated, "public record Lon(") + assertContains(t, lonGenerated, "Float value") + assertNotContains(t, lonGenerated, "public static Builder builder()") + assertNotContains(t, lonGenerated, "public static final class Builder") + + metaPath := filepath.Join(outputDir, "com", "test", "sdk", "models", "Meta.java") + metaContent, err := os.ReadFile(metaPath) + if err != nil { + t.Fatalf("read generated Meta model: %v", err) + } + metaGenerated := string(metaContent) + + assertContains(t, metaGenerated, "public record Meta(") + assertContains(t, metaGenerated, "java.util.Map value") + assertNotContains(t, metaGenerated, "public static Builder builder()") + assertNotContains(t, metaGenerated, "public static final class Builder") +} + func assertContains(t *testing.T, content, want string) { t.Helper() if !strings.Contains(content, want) { t.Fatalf("expected generated output to contain %q", want) } } + +func assertNotContains(t *testing.T, content, want string) { + t.Helper() + if strings.Contains(content, want) { + t.Fatalf("expected generated output to not contain %q", want) + } +} diff --git a/codegen/internal/generator/model.go b/codegen/internal/generator/model.go index 773e61c..aa70c3a 100644 --- a/codegen/internal/generator/model.go +++ b/codegen/internal/generator/model.go @@ -89,6 +89,7 @@ type schemaModel struct { AdditionalProps *additionalPropertiesModel Imports []string HasRequired bool + HasBuilder bool IsEnum bool EnumValues []enumValueModel } @@ -547,7 +548,8 @@ func buildSchemas(doc *v3.Document, params Params, resolver *typeResolver) []sch if additionalProps != nil { imports = withAdditionalPropertiesImports(imports) } - if hasRequired { + hasBuilder := shouldGenerateBuilder(fields, additionalProps) + if hasRequired && hasBuilder { imports = uniqueStrings(append(imports, "java.util.Objects")) } model := schemaModel{ @@ -559,12 +561,23 @@ func buildSchemas(doc *v3.Document, params Params, resolver *typeResolver) []sch AdditionalProps: additionalProps, Imports: imports, HasRequired: hasRequired, + HasBuilder: hasBuilder, } result = append(result, model) } return result } +// shouldGenerateBuilder reports whether the model should expose a builder. +// Single-field wrapper records (for example Lon/Lat/Meta-style aliases) don't +// benefit from a builder and should use the canonical record constructor. +func shouldGenerateBuilder(fields []schemaField, additionalProps *additionalPropertiesModel) bool { + if additionalProps != nil { + return true + } + return !(len(fields) == 1 && fields[0].Name == "value") +} + // buildSchemaFields inspects a schema proxy and returns the fields, required // imports, and a flag indicating whether any required properties exist. func buildSchemaFields(name string, ref *base.SchemaProxy, resolver *typeResolver) ([]schemaField, *additionalPropertiesModel, []string, bool) { diff --git a/codegen/internal/generator/render.go b/codegen/internal/generator/render.go index 0e7428b..d5f2f72 100644 --- a/codegen/internal/generator/render.go +++ b/codegen/internal/generator/render.go @@ -371,6 +371,7 @@ func prepareModelTemplateData(schema schemaModel) map[string]any { "Fields": schema.Fields, "AdditionalProps": schema.AdditionalProps, "HasRequired": schema.HasRequired, + "HasBuilder": schema.HasBuilder, "IsEnum": schema.IsEnum, "EnumValues": schema.EnumValues, } diff --git a/codegen/internal/generator/templates/model.tmpl b/codegen/internal/generator/templates/model.tmpl index f6f639e..c714d30 100644 --- a/codegen/internal/generator/templates/model.tmpl +++ b/codegen/internal/generator/templates/model.tmpl @@ -78,6 +78,7 @@ public record {{ .ClassName }}( } {{- end }} +{{- if .HasBuilder }} /** * Creates a builder for {{ .ClassName }}. * @@ -164,5 +165,6 @@ public record {{ .ClassName }}( {{- end }} } } +{{- end }} } {{- end }} diff --git a/codegen/internal/generator/types.go b/codegen/internal/generator/types.go index 59816ab..fa6379e 100644 --- a/codegen/internal/generator/types.go +++ b/codegen/internal/generator/types.go @@ -349,7 +349,8 @@ func (r *typeResolver) inlineSchemaModels(params Params) []schemaModel { if additionalProps != nil { imports = withAdditionalPropertiesImports(imports) } - if hasRequired { + hasBuilder := shouldGenerateBuilder(fields, additionalProps) + if hasRequired && hasBuilder { imports = uniqueStrings(append(imports, "java.util.Objects")) } models = append(models, schemaModel{ @@ -361,6 +362,7 @@ func (r *typeResolver) inlineSchemaModels(params Params) []schemaModel { AdditionalProps: additionalProps, Imports: imports, HasRequired: hasRequired, + HasBuilder: hasBuilder, }) info.processed = true added = true diff --git a/src/main/java/com/sumup/sdk/models/Attributes.java b/src/main/java/com/sumup/sdk/models/Attributes.java index 9a248a7..69e8d63 100644 --- a/src/main/java/com/sumup/sdk/models/Attributes.java +++ b/src/main/java/com/sumup/sdk/models/Attributes.java @@ -2,40 +2,4 @@ package com.sumup.sdk.models; /** Object attributes that are modifiable only by SumUp applications. */ -public record Attributes(java.util.Map value) { - /** - * Creates a builder for Attributes. - * - * @return Builder that constructs immutable Attributes instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Attributes instances. */ - public static final class Builder { - private java.util.Map value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(java.util.Map value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Attributes instance. - * - * @return Immutable Attributes. - */ - public Attributes build() { - return new Attributes(value); - } - } -} +public record Attributes(java.util.Map value) {} diff --git a/src/main/java/com/sumup/sdk/models/BusinessOwners.java b/src/main/java/com/sumup/sdk/models/BusinessOwners.java index cd1d53b..a6cd15b 100644 --- a/src/main/java/com/sumup/sdk/models/BusinessOwners.java +++ b/src/main/java/com/sumup/sdk/models/BusinessOwners.java @@ -2,40 +2,4 @@ package com.sumup.sdk.models; /** Business owners information. */ -public record BusinessOwners(java.util.List value) { - /** - * Creates a builder for BusinessOwners. - * - * @return Builder that constructs immutable BusinessOwners instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for BusinessOwners instances. */ - public static final class Builder { - private java.util.List value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(java.util.List value) { - this.value = value; - return this; - } - - /** - * Builds an immutable BusinessOwners instance. - * - * @return Immutable BusinessOwners. - */ - public BusinessOwners build() { - return new BusinessOwners(value); - } - } -} +public record BusinessOwners(java.util.List value) {} diff --git a/src/main/java/com/sumup/sdk/models/ChangeStatus.java b/src/main/java/com/sumup/sdk/models/ChangeStatus.java index d70c1ff..8720570 100644 --- a/src/main/java/com/sumup/sdk/models/ChangeStatus.java +++ b/src/main/java/com/sumup/sdk/models/ChangeStatus.java @@ -7,40 +7,4 @@ * have been applied, the status `done`. The status is only returned after write operations or on * read endpoints when the `version` query parameter is provided. */ -public record ChangeStatus(String value) { - /** - * Creates a builder for ChangeStatus. - * - * @return Builder that constructs immutable ChangeStatus instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ChangeStatus instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable ChangeStatus instance. - * - * @return Immutable ChangeStatus. - */ - public ChangeStatus build() { - return new ChangeStatus(value); - } - } -} +public record ChangeStatus(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/CheckoutSuccess.java b/src/main/java/com/sumup/sdk/models/CheckoutSuccess.java index fbed331..ae81f00 100644 --- a/src/main/java/com/sumup/sdk/models/CheckoutSuccess.java +++ b/src/main/java/com/sumup/sdk/models/CheckoutSuccess.java @@ -1,40 +1,4 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. package com.sumup.sdk.models; -public record CheckoutSuccess(com.sumup.sdk.models.Checkout value) { - /** - * Creates a builder for CheckoutSuccess. - * - * @return Builder that constructs immutable CheckoutSuccess instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CheckoutSuccess instances. */ - public static final class Builder { - private com.sumup.sdk.models.Checkout value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(com.sumup.sdk.models.Checkout value) { - this.value = value; - return this; - } - - /** - * Builds an immutable CheckoutSuccess instance. - * - * @return Immutable CheckoutSuccess. - */ - public CheckoutSuccess build() { - return new CheckoutSuccess(value); - } - } -} +public record CheckoutSuccess(com.sumup.sdk.models.Checkout value) {} diff --git a/src/main/java/com/sumup/sdk/models/CompanyIdentifiers.java b/src/main/java/com/sumup/sdk/models/CompanyIdentifiers.java index 2dfb9d1..2b8a0e0 100644 --- a/src/main/java/com/sumup/sdk/models/CompanyIdentifiers.java +++ b/src/main/java/com/sumup/sdk/models/CompanyIdentifiers.java @@ -2,40 +2,4 @@ package com.sumup.sdk.models; /** A list of country-specific company identifiers. */ -public record CompanyIdentifiers(java.util.List value) { - /** - * Creates a builder for CompanyIdentifiers. - * - * @return Builder that constructs immutable CompanyIdentifiers instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CompanyIdentifiers instances. */ - public static final class Builder { - private java.util.List value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(java.util.List value) { - this.value = value; - return this; - } - - /** - * Builds an immutable CompanyIdentifiers instance. - * - * @return Immutable CompanyIdentifiers. - */ - public CompanyIdentifiers build() { - return new CompanyIdentifiers(value); - } - } -} +public record CompanyIdentifiers(java.util.List value) {} diff --git a/src/main/java/com/sumup/sdk/models/CountryCode.java b/src/main/java/com/sumup/sdk/models/CountryCode.java index b303706..df3c0a5 100644 --- a/src/main/java/com/sumup/sdk/models/CountryCode.java +++ b/src/main/java/com/sumup/sdk/models/CountryCode.java @@ -6,40 +6,4 @@ * definition users `oneOf` with a two-character string type to allow for support of future * countries in client code. */ -public record CountryCode(String value) { - /** - * Creates a builder for CountryCode. - * - * @return Builder that constructs immutable CountryCode instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for CountryCode instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable CountryCode instance. - * - * @return Immutable CountryCode. - */ - public CountryCode build() { - return new CountryCode(value); - } - } -} +public record CountryCode(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/ErrorExtended.java b/src/main/java/com/sumup/sdk/models/ErrorExtended.java index 6f52ab3..98a7dbb 100644 --- a/src/main/java/com/sumup/sdk/models/ErrorExtended.java +++ b/src/main/java/com/sumup/sdk/models/ErrorExtended.java @@ -1,40 +1,4 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. package com.sumup.sdk.models; -public record ErrorExtended(com.sumup.sdk.models.Error value) { - /** - * Creates a builder for ErrorExtended. - * - * @return Builder that constructs immutable ErrorExtended instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ErrorExtended instances. */ - public static final class Builder { - private com.sumup.sdk.models.Error value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(com.sumup.sdk.models.Error value) { - this.value = value; - return this; - } - - /** - * Builds an immutable ErrorExtended instance. - * - * @return Immutable ErrorExtended. - */ - public ErrorExtended build() { - return new ErrorExtended(value); - } - } -} +public record ErrorExtended(com.sumup.sdk.models.Error value) {} diff --git a/src/main/java/com/sumup/sdk/models/EventId.java b/src/main/java/com/sumup/sdk/models/EventId.java index 7187115..0bc411b 100644 --- a/src/main/java/com/sumup/sdk/models/EventId.java +++ b/src/main/java/com/sumup/sdk/models/EventId.java @@ -2,40 +2,4 @@ package com.sumup.sdk.models; /** Unique ID of the transaction event. */ -public record EventId(Long value) { - /** - * Creates a builder for EventId. - * - * @return Builder that constructs immutable EventId instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for EventId instances. */ - public static final class Builder { - private Long value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(Long value) { - this.value = value; - return this; - } - - /** - * Builds an immutable EventId instance. - * - * @return Immutable EventId. - */ - public EventId build() { - return new EventId(value); - } - } -} +public record EventId(Long value) {} diff --git a/src/main/java/com/sumup/sdk/models/FinancialPayouts.java b/src/main/java/com/sumup/sdk/models/FinancialPayouts.java index 8d0f6a0..cb03993 100644 --- a/src/main/java/com/sumup/sdk/models/FinancialPayouts.java +++ b/src/main/java/com/sumup/sdk/models/FinancialPayouts.java @@ -1,40 +1,4 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. package com.sumup.sdk.models; -public record FinancialPayouts(java.util.List value) { - /** - * Creates a builder for FinancialPayouts. - * - * @return Builder that constructs immutable FinancialPayouts instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for FinancialPayouts instances. */ - public static final class Builder { - private java.util.List value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(java.util.List value) { - this.value = value; - return this; - } - - /** - * Builds an immutable FinancialPayouts instance. - * - * @return Immutable FinancialPayouts. - */ - public FinancialPayouts build() { - return new FinancialPayouts(value); - } - } -} +public record FinancialPayouts(java.util.List value) {} diff --git a/src/main/java/com/sumup/sdk/models/HorizontalAccuracy.java b/src/main/java/com/sumup/sdk/models/HorizontalAccuracy.java index 95b3632..62c4b4e 100644 --- a/src/main/java/com/sumup/sdk/models/HorizontalAccuracy.java +++ b/src/main/java/com/sumup/sdk/models/HorizontalAccuracy.java @@ -2,40 +2,4 @@ package com.sumup.sdk.models; /** Indication of the precision of the geographical position received from the payment terminal. */ -public record HorizontalAccuracy(Float value) { - /** - * Creates a builder for HorizontalAccuracy. - * - * @return Builder that constructs immutable HorizontalAccuracy instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for HorizontalAccuracy instances. */ - public static final class Builder { - private Float value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(Float value) { - this.value = value; - return this; - } - - /** - * Builds an immutable HorizontalAccuracy instance. - * - * @return Immutable HorizontalAccuracy. - */ - public HorizontalAccuracy build() { - return new HorizontalAccuracy(value); - } - } -} +public record HorizontalAccuracy(Float value) {} diff --git a/src/main/java/com/sumup/sdk/models/Lat.java b/src/main/java/com/sumup/sdk/models/Lat.java index 30f4853..df7a02d 100644 --- a/src/main/java/com/sumup/sdk/models/Lat.java +++ b/src/main/java/com/sumup/sdk/models/Lat.java @@ -5,40 +5,4 @@ * Latitude value from the coordinates of the payment location (as received from the payment * terminal reader). */ -public record Lat(Float value) { - /** - * Creates a builder for Lat. - * - * @return Builder that constructs immutable Lat instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Lat instances. */ - public static final class Builder { - private Float value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(Float value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Lat instance. - * - * @return Immutable Lat. - */ - public Lat build() { - return new Lat(value); - } - } -} +public record Lat(Float value) {} diff --git a/src/main/java/com/sumup/sdk/models/LegalType.java b/src/main/java/com/sumup/sdk/models/LegalType.java index 1dda2f0..ce6fcd8 100644 --- a/src/main/java/com/sumup/sdk/models/LegalType.java +++ b/src/main/java/com/sumup/sdk/models/LegalType.java @@ -6,40 +6,4 @@ * other services. Consumers of this API are expected to use the country SDK to map to any other * IDs, translation keys, or descriptions. */ -public record LegalType(String value) { - /** - * Creates a builder for LegalType. - * - * @return Builder that constructs immutable LegalType instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for LegalType instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable LegalType instance. - * - * @return Immutable LegalType. - */ - public LegalType build() { - return new LegalType(value); - } - } -} +public record LegalType(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/LinkRefund.java b/src/main/java/com/sumup/sdk/models/LinkRefund.java index ede5521..af1a8a6 100644 --- a/src/main/java/com/sumup/sdk/models/LinkRefund.java +++ b/src/main/java/com/sumup/sdk/models/LinkRefund.java @@ -1,40 +1,4 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. package com.sumup.sdk.models; -public record LinkRefund(com.sumup.sdk.models.Link value) { - /** - * Creates a builder for LinkRefund. - * - * @return Builder that constructs immutable LinkRefund instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for LinkRefund instances. */ - public static final class Builder { - private com.sumup.sdk.models.Link value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(com.sumup.sdk.models.Link value) { - this.value = value; - return this; - } - - /** - * Builds an immutable LinkRefund instance. - * - * @return Immutable LinkRefund. - */ - public LinkRefund build() { - return new LinkRefund(value); - } - } -} +public record LinkRefund(com.sumup.sdk.models.Link value) {} diff --git a/src/main/java/com/sumup/sdk/models/Lon.java b/src/main/java/com/sumup/sdk/models/Lon.java index d14366d..62242b9 100644 --- a/src/main/java/com/sumup/sdk/models/Lon.java +++ b/src/main/java/com/sumup/sdk/models/Lon.java @@ -5,40 +5,4 @@ * Longitude value from the coordinates of the payment location (as received from the payment * terminal reader). */ -public record Lon(Float value) { - /** - * Creates a builder for Lon. - * - * @return Builder that constructs immutable Lon instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Lon instances. */ - public static final class Builder { - private Float value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(Float value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Lon instance. - * - * @return Immutable Lon. - */ - public Lon build() { - return new Lon(value); - } - } -} +public record Lon(Float value) {} diff --git a/src/main/java/com/sumup/sdk/models/Merchant.java b/src/main/java/com/sumup/sdk/models/Merchant.java index 3b73ecd..1456acb 100644 --- a/src/main/java/com/sumup/sdk/models/Merchant.java +++ b/src/main/java/com/sumup/sdk/models/Merchant.java @@ -1,40 +1,4 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. package com.sumup.sdk.models; -public record Merchant(com.sumup.sdk.models.Merchant2 value) { - /** - * Creates a builder for Merchant. - * - * @return Builder that constructs immutable Merchant instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Merchant instances. */ - public static final class Builder { - private com.sumup.sdk.models.Merchant2 value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(com.sumup.sdk.models.Merchant2 value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Merchant instance. - * - * @return Immutable Merchant. - */ - public Merchant build() { - return new Merchant(value); - } - } -} +public record Merchant(com.sumup.sdk.models.Merchant2 value) {} diff --git a/src/main/java/com/sumup/sdk/models/Meta.java b/src/main/java/com/sumup/sdk/models/Meta.java index ed040ce..5811e08 100644 --- a/src/main/java/com/sumup/sdk/models/Meta.java +++ b/src/main/java/com/sumup/sdk/models/Meta.java @@ -6,40 +6,4 @@ * additional information about the object in a structured format. **Warning**: Updating Meta will * overwrite the existing data. Make sure to always include the complete JSON object. */ -public record Meta(java.util.Map value) { - /** - * Creates a builder for Meta. - * - * @return Builder that constructs immutable Meta instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Meta instances. */ - public static final class Builder { - private java.util.Map value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(java.util.Map value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Meta instance. - * - * @return Immutable Meta. - */ - public Meta build() { - return new Meta(value); - } - } -} +public record Meta(java.util.Map value) {} diff --git a/src/main/java/com/sumup/sdk/models/Metadata.java b/src/main/java/com/sumup/sdk/models/Metadata.java index b318528..ad2ab1d 100644 --- a/src/main/java/com/sumup/sdk/models/Metadata.java +++ b/src/main/java/com/sumup/sdk/models/Metadata.java @@ -5,40 +5,4 @@ * Set of user-defined key-value pairs attached to the object. Partial updates are not supported. * When updating, always submit whole metadata. Maximum of 64 parameters are allowed in the object. */ -public record Metadata(java.util.Map value) { - /** - * Creates a builder for Metadata. - * - * @return Builder that constructs immutable Metadata instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Metadata instances. */ - public static final class Builder { - private java.util.Map value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(java.util.Map value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Metadata instance. - * - * @return Immutable Metadata. - */ - public Metadata build() { - return new Metadata(value); - } - } -} +public record Metadata(java.util.Map value) {} diff --git a/src/main/java/com/sumup/sdk/models/Person.java b/src/main/java/com/sumup/sdk/models/Person.java index 1b5d82a..671779b 100644 --- a/src/main/java/com/sumup/sdk/models/Person.java +++ b/src/main/java/com/sumup/sdk/models/Person.java @@ -1,40 +1,4 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. package com.sumup.sdk.models; -public record Person(com.sumup.sdk.models.BasePerson value) { - /** - * Creates a builder for Person. - * - * @return Builder that constructs immutable Person instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Person instances. */ - public static final class Builder { - private com.sumup.sdk.models.BasePerson value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(com.sumup.sdk.models.BasePerson value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Person instance. - * - * @return Immutable Person. - */ - public Person build() { - return new Person(value); - } - } -} +public record Person(com.sumup.sdk.models.BasePerson value) {} diff --git a/src/main/java/com/sumup/sdk/models/PhoneNumber.java b/src/main/java/com/sumup/sdk/models/PhoneNumber.java index 617e581..821d4f6 100644 --- a/src/main/java/com/sumup/sdk/models/PhoneNumber.java +++ b/src/main/java/com/sumup/sdk/models/PhoneNumber.java @@ -2,40 +2,4 @@ package com.sumup.sdk.models; /** A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format. */ -public record PhoneNumber(String value) { - /** - * Creates a builder for PhoneNumber. - * - * @return Builder that constructs immutable PhoneNumber instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for PhoneNumber instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable PhoneNumber instance. - * - * @return Immutable PhoneNumber. - */ - public PhoneNumber build() { - return new PhoneNumber(value); - } - } -} +public record PhoneNumber(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/ReaderId.java b/src/main/java/com/sumup/sdk/models/ReaderId.java index 05ef8c9..bf329a8 100644 --- a/src/main/java/com/sumup/sdk/models/ReaderId.java +++ b/src/main/java/com/sumup/sdk/models/ReaderId.java @@ -7,40 +7,4 @@ * [delete](https://developer.sumup.com/api/readers/delete-reader) a reader, and pair the device * again, the ID will be different. Do not use this ID to refer to a physical device. */ -public record ReaderId(String value) { - /** - * Creates a builder for ReaderId. - * - * @return Builder that constructs immutable ReaderId instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ReaderId instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable ReaderId instance. - * - * @return Immutable ReaderId. - */ - public ReaderId build() { - return new ReaderId(value); - } - } -} +public record ReaderId(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/ReaderName.java b/src/main/java/com/sumup/sdk/models/ReaderName.java index 32b9563..aa85cdc 100644 --- a/src/main/java/com/sumup/sdk/models/ReaderName.java +++ b/src/main/java/com/sumup/sdk/models/ReaderName.java @@ -2,40 +2,4 @@ package com.sumup.sdk.models; /** Custom human-readable, user-defined name for easier identification of the reader. */ -public record ReaderName(String value) { - /** - * Creates a builder for ReaderName. - * - * @return Builder that constructs immutable ReaderName instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ReaderName instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable ReaderName instance. - * - * @return Immutable ReaderName. - */ - public ReaderName build() { - return new ReaderName(value); - } - } -} +public record ReaderName(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/ReaderPairingCode.java b/src/main/java/com/sumup/sdk/models/ReaderPairingCode.java index 3a712ac..6c9c18c 100644 --- a/src/main/java/com/sumup/sdk/models/ReaderPairingCode.java +++ b/src/main/java/com/sumup/sdk/models/ReaderPairingCode.java @@ -5,40 +5,4 @@ * The pairing code is a 8 or 9 character alphanumeric string that is displayed on a SumUp Device * after initiating the pairing. It is used to link the physical device to the created pairing. */ -public record ReaderPairingCode(String value) { - /** - * Creates a builder for ReaderPairingCode. - * - * @return Builder that constructs immutable ReaderPairingCode instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ReaderPairingCode instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable ReaderPairingCode instance. - * - * @return Immutable ReaderPairingCode. - */ - public ReaderPairingCode build() { - return new ReaderPairingCode(value); - } - } -} +public record ReaderPairingCode(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/ResourceType.java b/src/main/java/com/sumup/sdk/models/ResourceType.java index 29874ba..8c89b91 100644 --- a/src/main/java/com/sumup/sdk/models/ResourceType.java +++ b/src/main/java/com/sumup/sdk/models/ResourceType.java @@ -5,40 +5,4 @@ * The type of the membership resource. Possible values are: * `merchant` - merchant account(s) * * `organization` - organization(s) */ -public record ResourceType(String value) { - /** - * Creates a builder for ResourceType. - * - * @return Builder that constructs immutable ResourceType instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for ResourceType instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable ResourceType instance. - * - * @return Immutable ResourceType. - */ - public ResourceType build() { - return new ResourceType(value); - } - } -} +public record ResourceType(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/TransactionFull.java b/src/main/java/com/sumup/sdk/models/TransactionFull.java index 530a5de..5a96d02 100644 --- a/src/main/java/com/sumup/sdk/models/TransactionFull.java +++ b/src/main/java/com/sumup/sdk/models/TransactionFull.java @@ -1,40 +1,4 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. package com.sumup.sdk.models; -public record TransactionFull(com.sumup.sdk.models.TransactionBase value) { - /** - * Creates a builder for TransactionFull. - * - * @return Builder that constructs immutable TransactionFull instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for TransactionFull instances. */ - public static final class Builder { - private com.sumup.sdk.models.TransactionBase value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(com.sumup.sdk.models.TransactionBase value) { - this.value = value; - return this; - } - - /** - * Builds an immutable TransactionFull instance. - * - * @return Immutable TransactionFull. - */ - public TransactionFull build() { - return new TransactionFull(value); - } - } -} +public record TransactionFull(com.sumup.sdk.models.TransactionBase value) {} diff --git a/src/main/java/com/sumup/sdk/models/TransactionHistory.java b/src/main/java/com/sumup/sdk/models/TransactionHistory.java index 18e76aa..6fc59ea 100644 --- a/src/main/java/com/sumup/sdk/models/TransactionHistory.java +++ b/src/main/java/com/sumup/sdk/models/TransactionHistory.java @@ -1,40 +1,4 @@ // Code generated by sumup-java/codegen. DO NOT EDIT. package com.sumup.sdk.models; -public record TransactionHistory(com.sumup.sdk.models.TransactionBase value) { - /** - * Creates a builder for TransactionHistory. - * - * @return Builder that constructs immutable TransactionHistory instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for TransactionHistory instances. */ - public static final class Builder { - private com.sumup.sdk.models.TransactionBase value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(com.sumup.sdk.models.TransactionBase value) { - this.value = value; - return this; - } - - /** - * Builds an immutable TransactionHistory instance. - * - * @return Immutable TransactionHistory. - */ - public TransactionHistory build() { - return new TransactionHistory(value); - } - } -} +public record TransactionHistory(com.sumup.sdk.models.TransactionBase value) {} diff --git a/src/main/java/com/sumup/sdk/models/TransactionId.java b/src/main/java/com/sumup/sdk/models/TransactionId.java index 70f8ecc..b5803c8 100644 --- a/src/main/java/com/sumup/sdk/models/TransactionId.java +++ b/src/main/java/com/sumup/sdk/models/TransactionId.java @@ -2,40 +2,4 @@ package com.sumup.sdk.models; /** Unique ID of the transaction. */ -public record TransactionId(String value) { - /** - * Creates a builder for TransactionId. - * - * @return Builder that constructs immutable TransactionId instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for TransactionId instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable TransactionId instance. - * - * @return Immutable TransactionId. - */ - public TransactionId build() { - return new TransactionId(value); - } - } -} +public record TransactionId(String value) {} diff --git a/src/main/java/com/sumup/sdk/models/Version.java b/src/main/java/com/sumup/sdk/models/Version.java index 9227523..b271038 100644 --- a/src/main/java/com/sumup/sdk/models/Version.java +++ b/src/main/java/com/sumup/sdk/models/Version.java @@ -5,40 +5,4 @@ * The version of the resource. The version reflects a specific change submitted to the API via one * of the `PATCH` endpoints. */ -public record Version(String value) { - /** - * Creates a builder for Version. - * - * @return Builder that constructs immutable Version instances. - */ - public static Builder builder() { - return new Builder(); - } - - /** Builder for Version instances. */ - public static final class Builder { - private String value; - - private Builder() {} - - /** - * Sets the value for {@code value}. - * - * @param value Value for the value field. - * @return This builder instance. - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds an immutable Version instance. - * - * @return Immutable Version. - */ - public Version build() { - return new Version(value); - } - } -} +public record Version(String value) {}