Skip to content

Commit dbe63c1

Browse files
committed
build(codegen): updating SDK
1 parent 2de3a9d commit dbe63c1

File tree

6 files changed

+158
-7
lines changed

6 files changed

+158
-7
lines changed

commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/common/FieldDefinitionBuilder.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ public class FieldDefinitionBuilder implements Builder<FieldDefinition> {
4040

4141
/**
4242
* <p>Data type of the Custom Field to define.</p>
43-
* @param type value to be set
43+
* @param builder function to build the type value
4444
* @return Builder
4545
*/
4646

47-
public FieldDefinitionBuilder type(final com.commercetools.history.models.common.FieldType type) {
48-
this.type = type;
47+
public FieldDefinitionBuilder type(
48+
Function<com.commercetools.history.models.common.FieldTypeBuilder, com.commercetools.history.models.common.FieldTypeBuilder> builder) {
49+
this.type = builder.apply(com.commercetools.history.models.common.FieldTypeBuilder.of()).build();
4950
return this;
5051
}
5152

@@ -55,9 +56,20 @@ public FieldDefinitionBuilder type(final com.commercetools.history.models.common
5556
* @return Builder
5657
*/
5758

58-
public FieldDefinitionBuilder type(
59-
Function<com.commercetools.history.models.common.FieldTypeBuilder, Builder<? extends com.commercetools.history.models.common.FieldType>> builder) {
60-
this.type = builder.apply(com.commercetools.history.models.common.FieldTypeBuilder.of()).build();
59+
public FieldDefinitionBuilder withType(
60+
Function<com.commercetools.history.models.common.FieldTypeBuilder, com.commercetools.history.models.common.FieldType> builder) {
61+
this.type = builder.apply(com.commercetools.history.models.common.FieldTypeBuilder.of());
62+
return this;
63+
}
64+
65+
/**
66+
* <p>Data type of the Custom Field to define.</p>
67+
* @param type value to be set
68+
* @return Builder
69+
*/
70+
71+
public FieldDefinitionBuilder type(final com.commercetools.history.models.common.FieldType type) {
72+
this.type = type;
6173
return this;
6274
}
6375

commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/common/FieldType.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
* <div class=code-example>
2323
* <pre><code class='java'>
2424
* FieldType fieldType = FieldType.builder()
25+
* .name("{name}")
2526
* .build()
2627
* </code></pre>
2728
* </div>
2829
*/
2930
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
31+
@JsonDeserialize(as = FieldTypeImpl.class)
3032
public interface FieldType {
3133

3234
/**
@@ -37,6 +39,32 @@ public interface FieldType {
3739
@JsonProperty("name")
3840
public String getName();
3941

42+
/**
43+
* set name
44+
* @param name value to be set
45+
*/
46+
47+
public void setName(final String name);
48+
49+
/**
50+
* factory method
51+
* @return instance of FieldType
52+
*/
53+
public static FieldType of() {
54+
return new FieldTypeImpl();
55+
}
56+
57+
/**
58+
* factory method to create a shallow copy FieldType
59+
* @param template instance to be copied
60+
* @return copy instance
61+
*/
62+
public static FieldType of(final FieldType template) {
63+
FieldTypeImpl instance = new FieldTypeImpl();
64+
instance.setName(template.getName());
65+
return instance;
66+
}
67+
4068
public FieldType copyDeep();
4169

4270
/**
@@ -50,9 +78,27 @@ public static FieldType deepCopy(@Nullable final FieldType template) {
5078
return null;
5179
}
5280
FieldTypeImpl instance = new FieldTypeImpl();
81+
instance.setName(template.getName());
5382
return instance;
5483
}
5584

85+
/**
86+
* builder factory method for FieldType
87+
* @return builder
88+
*/
89+
public static FieldTypeBuilder builder() {
90+
return FieldTypeBuilder.of();
91+
}
92+
93+
/**
94+
* create builder for FieldType instance
95+
* @param template instance with prefilled values for the builder
96+
* @return builder
97+
*/
98+
public static FieldTypeBuilder builder(final FieldType template) {
99+
return FieldTypeBuilder.of(template);
100+
}
101+
56102
/**
57103
* accessor map function
58104
* @param <T> mapped type

commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/common/FieldTypeBuilder.java

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,62 @@
33

44
import java.util.*;
55

6+
import io.vrap.rmf.base.client.Builder;
67
import io.vrap.rmf.base.client.utils.Generated;
78

89
/**
910
* FieldTypeBuilder
11+
* <hr>
12+
* Example to create an instance using the builder pattern
13+
* <div class=code-example>
14+
* <pre><code class='java'>
15+
* FieldType fieldType = FieldType.builder()
16+
* .name("{name}")
17+
* .build()
18+
* </code></pre>
19+
* </div>
1020
*/
1121
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
12-
public class FieldTypeBuilder {
22+
public class FieldTypeBuilder implements Builder<FieldType> {
23+
24+
private String name;
25+
26+
/**
27+
* set the value to the name
28+
* @param name value to be set
29+
* @return Builder
30+
*/
31+
32+
public FieldTypeBuilder name(final String name) {
33+
this.name = name;
34+
return this;
35+
}
36+
37+
/**
38+
* value of name}
39+
* @return name
40+
*/
41+
42+
public String getName() {
43+
return this.name;
44+
}
45+
46+
/**
47+
* builds FieldType with checking for non-null required values
48+
* @return FieldType
49+
*/
50+
public FieldType build() {
51+
Objects.requireNonNull(name, FieldType.class + ": name is missing");
52+
return new FieldTypeImpl(name);
53+
}
54+
55+
/**
56+
* builds FieldType without checking for non-null required values
57+
* @return FieldType
58+
*/
59+
public FieldType buildUnchecked() {
60+
return new FieldTypeImpl(name);
61+
}
1362

1463
/**
1564
* factory method for an instance of FieldTypeBuilder
@@ -19,4 +68,15 @@ public static FieldTypeBuilder of() {
1968
return new FieldTypeBuilder();
2069
}
2170

71+
/**
72+
* create builder for FieldType instance
73+
* @param template instance with prefilled values for the builder
74+
* @return builder
75+
*/
76+
public static FieldTypeBuilder of(final FieldType template) {
77+
FieldTypeBuilder builder = new FieldTypeBuilder();
78+
builder.name = template.getName();
79+
return builder;
80+
}
81+
2282
}

commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/common/FieldTypeImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public String getName() {
4646
return this.name;
4747
}
4848

49+
public void setName(final String name) {
50+
this.name = name;
51+
}
52+
4953
@Override
5054
public boolean equals(Object o) {
5155
if (this == o)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
package com.commercetools.history.models.common;
3+
4+
import org.assertj.core.api.Assertions;
5+
import org.junit.jupiter.api.Test;
6+
import org.junit.jupiter.params.ParameterizedTest;
7+
import org.junit.jupiter.params.provider.MethodSource;
8+
9+
public class FieldTypeTest {
10+
11+
@ParameterizedTest(name = "#{index} with {0}")
12+
@MethodSource("objectBuilder")
13+
public void buildUnchecked(String name, FieldTypeBuilder builder) {
14+
FieldType fieldType = builder.buildUnchecked();
15+
Assertions.assertThat(fieldType).isInstanceOf(FieldType.class);
16+
}
17+
18+
public static Object[][] objectBuilder() {
19+
return new Object[][] { new Object[] { "name", FieldType.builder().name("name") } };
20+
}
21+
22+
@Test
23+
public void name() {
24+
FieldType value = FieldType.of();
25+
value.setName("name");
26+
Assertions.assertThat(value.getName()).isEqualTo("name");
27+
}
28+
}

references.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,4 @@ fea3fbfdc8dedcaeb467c0c66bd4968c1d79156c
491491
18c787052fbe07c50524d8249ada01228db2a8c9
492492
681c61f208c763fb7e0171b337956ebd3773aba1
493493
7fe613ca616e3dc91ba35bb3a8109ff1a4ec534a
494+
f3c35b1b92ccc332f0b95003f0f22ea8f0e5f8e0

0 commit comments

Comments
 (0)