Skip to content

Commit 8560eb3

Browse files
committed
build(codegen): updating SDK
1 parent 3f5c978 commit 8560eb3

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/AttributeDefinitionBuilder.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ public class AttributeDefinitionBuilder implements Builder<AttributeDefinition>
5252

5353
/**
5454
* <p>Describes the Type of the Attribute.</p>
55-
* @param type value to be set
55+
* @param builder function to build the type value
5656
* @return Builder
5757
*/
5858

59-
public AttributeDefinitionBuilder type(final com.commercetools.history.models.common.AttributeType type) {
60-
this.type = type;
59+
public AttributeDefinitionBuilder type(
60+
Function<com.commercetools.history.models.common.AttributeTypeBuilder, com.commercetools.history.models.common.AttributeTypeBuilder> builder) {
61+
this.type = builder.apply(com.commercetools.history.models.common.AttributeTypeBuilder.of()).build();
6162
return this;
6263
}
6364

@@ -67,9 +68,20 @@ public AttributeDefinitionBuilder type(final com.commercetools.history.models.co
6768
* @return Builder
6869
*/
6970

70-
public AttributeDefinitionBuilder type(
71-
Function<com.commercetools.history.models.common.AttributeTypeBuilder, Builder<? extends com.commercetools.history.models.common.AttributeType>> builder) {
72-
this.type = builder.apply(com.commercetools.history.models.common.AttributeTypeBuilder.of()).build();
71+
public AttributeDefinitionBuilder withType(
72+
Function<com.commercetools.history.models.common.AttributeTypeBuilder, com.commercetools.history.models.common.AttributeType> builder) {
73+
this.type = builder.apply(com.commercetools.history.models.common.AttributeTypeBuilder.of());
74+
return this;
75+
}
76+
77+
/**
78+
* <p>Describes the Type of the Attribute.</p>
79+
* @param type value to be set
80+
* @return Builder
81+
*/
82+
83+
public AttributeDefinitionBuilder type(final com.commercetools.history.models.common.AttributeType type) {
84+
this.type = type;
7385
return this;
7486
}
7587

commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/common/AttributeType.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
* AttributeType attributeType = AttributeType.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 = AttributeTypeImpl.class)
3032
public interface AttributeType {
3133

3234
/**
@@ -37,6 +39,32 @@ public interface AttributeType {
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 AttributeType
52+
*/
53+
public static AttributeType of() {
54+
return new AttributeTypeImpl();
55+
}
56+
57+
/**
58+
* factory method to create a shallow copy AttributeType
59+
* @param template instance to be copied
60+
* @return copy instance
61+
*/
62+
public static AttributeType of(final AttributeType template) {
63+
AttributeTypeImpl instance = new AttributeTypeImpl();
64+
instance.setName(template.getName());
65+
return instance;
66+
}
67+
4068
public AttributeType copyDeep();
4169

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

85+
/**
86+
* builder factory method for AttributeType
87+
* @return builder
88+
*/
89+
public static AttributeTypeBuilder builder() {
90+
return AttributeTypeBuilder.of();
91+
}
92+
93+
/**
94+
* create builder for AttributeType instance
95+
* @param template instance with prefilled values for the builder
96+
* @return builder
97+
*/
98+
public static AttributeTypeBuilder builder(final AttributeType template) {
99+
return AttributeTypeBuilder.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/AttributeTypeBuilder.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
* AttributeTypeBuilder
11+
* <hr>
12+
* Example to create an instance using the builder pattern
13+
* <div class=code-example>
14+
* <pre><code class='java'>
15+
* AttributeType attributeType = AttributeType.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 AttributeTypeBuilder {
22+
public class AttributeTypeBuilder implements Builder<AttributeType> {
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 AttributeTypeBuilder 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 AttributeType with checking for non-null required values
48+
* @return AttributeType
49+
*/
50+
public AttributeType build() {
51+
Objects.requireNonNull(name, AttributeType.class + ": name is missing");
52+
return new AttributeTypeImpl(name);
53+
}
54+
55+
/**
56+
* builds AttributeType without checking for non-null required values
57+
* @return AttributeType
58+
*/
59+
public AttributeType buildUnchecked() {
60+
return new AttributeTypeImpl(name);
61+
}
1362

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

71+
/**
72+
* create builder for AttributeType instance
73+
* @param template instance with prefilled values for the builder
74+
* @return builder
75+
*/
76+
public static AttributeTypeBuilder of(final AttributeType template) {
77+
AttributeTypeBuilder builder = new AttributeTypeBuilder();
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/AttributeTypeImpl.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 AttributeTypeTest {
10+
11+
@ParameterizedTest(name = "#{index} with {0}")
12+
@MethodSource("objectBuilder")
13+
public void buildUnchecked(String name, AttributeTypeBuilder builder) {
14+
AttributeType attributeType = builder.buildUnchecked();
15+
Assertions.assertThat(attributeType).isInstanceOf(AttributeType.class);
16+
}
17+
18+
public static Object[][] objectBuilder() {
19+
return new Object[][] { new Object[] { "name", AttributeType.builder().name("name") } };
20+
}
21+
22+
@Test
23+
public void name() {
24+
AttributeType value = AttributeType.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
@@ -489,3 +489,4 @@ e5d97cd9fa03ef3c4fe45f051ad8a4a80e690656
489489
fea3fbfdc8dedcaeb467c0c66bd4968c1d79156c
490490
0eb82a344545c68d83a79ce78e4d353ba3a94a6f
491491
18c787052fbe07c50524d8249ada01228db2a8c9
492+
681c61f208c763fb7e0171b337956ebd3773aba1

0 commit comments

Comments
 (0)