Skip to content

Commit ce82403

Browse files
committed
build(codegen): updating SDK
1 parent 4194eb8 commit ce82403

File tree

12 files changed

+617
-2
lines changed

12 files changed

+617
-2
lines changed

changes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090

9191
- added type `DirectDiscount`
9292
- added type `DiscountTypeCombination`
93+
- added type `BestDeal`
94+
- added type `Stacking`
9395
- added type `ShippingMethodLabel`
9496
- added type `ChangeCustomLineItemPriceRoundingModeChange`
9597
- added type `ChangeLineItemPriceRoundingModeChange`
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
2+
package com.commercetools.history.models.common;
3+
4+
import java.time.*;
5+
import java.util.*;
6+
import java.util.function.Function;
7+
8+
import javax.annotation.Nullable;
9+
10+
import com.fasterxml.jackson.annotation.*;
11+
import com.fasterxml.jackson.databind.annotation.*;
12+
13+
import io.vrap.rmf.base.client.utils.Generated;
14+
15+
import jakarta.validation.constraints.NotNull;
16+
17+
/**
18+
* <p>Indicates if a Product Discount or Cart Discount offers the best deal for a Cart or Order.</p>
19+
*
20+
* <hr>
21+
* Example to create an instance using the builder pattern
22+
* <div class=code-example>
23+
* <pre><code class='java'>
24+
* BestDeal bestDeal = BestDeal.builder()
25+
* .chosenDiscountType("{chosenDiscountType}")
26+
* .build()
27+
* </code></pre>
28+
* </div>
29+
*/
30+
@io.vrap.rmf.base.client.utils.json.SubType("BestDeal")
31+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
32+
@JsonDeserialize(as = BestDealImpl.class)
33+
public interface BestDeal extends DiscountTypeCombination {
34+
35+
/**
36+
* discriminator value for BestDeal
37+
*/
38+
String BEST_DEAL = "BestDeal";
39+
40+
/**
41+
* <p>Discount type that offers the best deal; the value can be <code>ProductDiscount</code> or <code>CartDiscount</code>.</p>
42+
* @return chosenDiscountType
43+
*/
44+
@NotNull
45+
@JsonProperty("chosenDiscountType")
46+
public String getChosenDiscountType();
47+
48+
/**
49+
* <p>Discount type that offers the best deal; the value can be <code>ProductDiscount</code> or <code>CartDiscount</code>.</p>
50+
* @param chosenDiscountType value to be set
51+
*/
52+
53+
public void setChosenDiscountType(final String chosenDiscountType);
54+
55+
/**
56+
* factory method
57+
* @return instance of BestDeal
58+
*/
59+
public static BestDeal of() {
60+
return new BestDealImpl();
61+
}
62+
63+
/**
64+
* factory method to create a shallow copy BestDeal
65+
* @param template instance to be copied
66+
* @return copy instance
67+
*/
68+
public static BestDeal of(final BestDeal template) {
69+
BestDealImpl instance = new BestDealImpl();
70+
instance.setChosenDiscountType(template.getChosenDiscountType());
71+
return instance;
72+
}
73+
74+
public BestDeal copyDeep();
75+
76+
/**
77+
* factory method to create a deep copy of BestDeal
78+
* @param template instance to be copied
79+
* @return copy instance
80+
*/
81+
@Nullable
82+
public static BestDeal deepCopy(@Nullable final BestDeal template) {
83+
if (template == null) {
84+
return null;
85+
}
86+
BestDealImpl instance = new BestDealImpl();
87+
instance.setChosenDiscountType(template.getChosenDiscountType());
88+
return instance;
89+
}
90+
91+
/**
92+
* builder factory method for BestDeal
93+
* @return builder
94+
*/
95+
public static BestDealBuilder builder() {
96+
return BestDealBuilder.of();
97+
}
98+
99+
/**
100+
* create builder for BestDeal instance
101+
* @param template instance with prefilled values for the builder
102+
* @return builder
103+
*/
104+
public static BestDealBuilder builder(final BestDeal template) {
105+
return BestDealBuilder.of(template);
106+
}
107+
108+
/**
109+
* accessor map function
110+
* @param <T> mapped type
111+
* @param helper function to map the object
112+
* @return mapped value
113+
*/
114+
default <T> T withBestDeal(Function<BestDeal, T> helper) {
115+
return helper.apply(this);
116+
}
117+
118+
/**
119+
* gives a TypeReference for usage with Jackson DataBind
120+
* @return TypeReference
121+
*/
122+
public static com.fasterxml.jackson.core.type.TypeReference<BestDeal> typeReference() {
123+
return new com.fasterxml.jackson.core.type.TypeReference<BestDeal>() {
124+
@Override
125+
public String toString() {
126+
return "TypeReference<BestDeal>";
127+
}
128+
};
129+
}
130+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
2+
package com.commercetools.history.models.common;
3+
4+
import java.util.*;
5+
6+
import io.vrap.rmf.base.client.Builder;
7+
import io.vrap.rmf.base.client.utils.Generated;
8+
9+
/**
10+
* BestDealBuilder
11+
* <hr>
12+
* Example to create an instance using the builder pattern
13+
* <div class=code-example>
14+
* <pre><code class='java'>
15+
* BestDeal bestDeal = BestDeal.builder()
16+
* .chosenDiscountType("{chosenDiscountType}")
17+
* .build()
18+
* </code></pre>
19+
* </div>
20+
*/
21+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
22+
public class BestDealBuilder implements Builder<BestDeal> {
23+
24+
private String chosenDiscountType;
25+
26+
/**
27+
* <p>Discount type that offers the best deal; the value can be <code>ProductDiscount</code> or <code>CartDiscount</code>.</p>
28+
* @param chosenDiscountType value to be set
29+
* @return Builder
30+
*/
31+
32+
public BestDealBuilder chosenDiscountType(final String chosenDiscountType) {
33+
this.chosenDiscountType = chosenDiscountType;
34+
return this;
35+
}
36+
37+
/**
38+
* <p>Discount type that offers the best deal; the value can be <code>ProductDiscount</code> or <code>CartDiscount</code>.</p>
39+
* @return chosenDiscountType
40+
*/
41+
42+
public String getChosenDiscountType() {
43+
return this.chosenDiscountType;
44+
}
45+
46+
/**
47+
* builds BestDeal with checking for non-null required values
48+
* @return BestDeal
49+
*/
50+
public BestDeal build() {
51+
Objects.requireNonNull(chosenDiscountType, BestDeal.class + ": chosenDiscountType is missing");
52+
return new BestDealImpl(chosenDiscountType);
53+
}
54+
55+
/**
56+
* builds BestDeal without checking for non-null required values
57+
* @return BestDeal
58+
*/
59+
public BestDeal buildUnchecked() {
60+
return new BestDealImpl(chosenDiscountType);
61+
}
62+
63+
/**
64+
* factory method for an instance of BestDealBuilder
65+
* @return builder
66+
*/
67+
public static BestDealBuilder of() {
68+
return new BestDealBuilder();
69+
}
70+
71+
/**
72+
* create builder for BestDeal instance
73+
* @param template instance with prefilled values for the builder
74+
* @return builder
75+
*/
76+
public static BestDealBuilder of(final BestDeal template) {
77+
BestDealBuilder builder = new BestDealBuilder();
78+
builder.chosenDiscountType = template.getChosenDiscountType();
79+
return builder;
80+
}
81+
82+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
2+
package com.commercetools.history.models.common;
3+
4+
import java.time.*;
5+
import java.util.*;
6+
7+
import com.fasterxml.jackson.annotation.JsonCreator;
8+
import com.fasterxml.jackson.annotation.JsonProperty;
9+
import com.fasterxml.jackson.databind.annotation.*;
10+
11+
import io.vrap.rmf.base.client.ModelBase;
12+
import io.vrap.rmf.base.client.utils.Generated;
13+
14+
import org.apache.commons.lang3.builder.EqualsBuilder;
15+
import org.apache.commons.lang3.builder.HashCodeBuilder;
16+
import org.apache.commons.lang3.builder.ToStringBuilder;
17+
import org.apache.commons.lang3.builder.ToStringStyle;
18+
19+
/**
20+
* <p>Indicates if a Product Discount or Cart Discount offers the best deal for a Cart or Order.</p>
21+
*/
22+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
23+
public class BestDealImpl implements BestDeal, ModelBase {
24+
25+
private String type;
26+
27+
private String chosenDiscountType;
28+
29+
/**
30+
* create instance with all properties
31+
*/
32+
@JsonCreator
33+
BestDealImpl(@JsonProperty("chosenDiscountType") final String chosenDiscountType) {
34+
this.chosenDiscountType = chosenDiscountType;
35+
this.type = BEST_DEAL;
36+
}
37+
38+
/**
39+
* create empty instance
40+
*/
41+
public BestDealImpl() {
42+
this.type = BEST_DEAL;
43+
}
44+
45+
/**
46+
*
47+
*/
48+
49+
public String getType() {
50+
return this.type;
51+
}
52+
53+
/**
54+
* <p>Discount type that offers the best deal; the value can be <code>ProductDiscount</code> or <code>CartDiscount</code>.</p>
55+
*/
56+
57+
public String getChosenDiscountType() {
58+
return this.chosenDiscountType;
59+
}
60+
61+
public void setChosenDiscountType(final String chosenDiscountType) {
62+
this.chosenDiscountType = chosenDiscountType;
63+
}
64+
65+
@Override
66+
public boolean equals(Object o) {
67+
if (this == o)
68+
return true;
69+
70+
if (o == null || getClass() != o.getClass())
71+
return false;
72+
73+
BestDealImpl that = (BestDealImpl) o;
74+
75+
return new EqualsBuilder().append(type, that.type)
76+
.append(chosenDiscountType, that.chosenDiscountType)
77+
.append(type, that.type)
78+
.append(chosenDiscountType, that.chosenDiscountType)
79+
.isEquals();
80+
}
81+
82+
@Override
83+
public int hashCode() {
84+
return new HashCodeBuilder(17, 37).append(type).append(chosenDiscountType).toHashCode();
85+
}
86+
87+
@Override
88+
public String toString() {
89+
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("type", type)
90+
.append("chosenDiscountType", chosenDiscountType)
91+
.build();
92+
}
93+
94+
@Override
95+
public BestDeal copyDeep() {
96+
return BestDeal.deepCopy(this);
97+
}
98+
}

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@
1818
* DiscountTypeCombination
1919
*
2020
* <hr>
21-
* Example to create an instance using the builder pattern
21+
* Example to create a subtype instance using the builder pattern
2222
* <div class=code-example>
2323
* <pre><code class='java'>
24-
* DiscountTypeCombination discountTypeCombination = DiscountTypeCombination.builder()
24+
* DiscountTypeCombination discountTypeCombination = DiscountTypeCombination.bestDealBuilder()
25+
* chosenDiscountType("{chosenDiscountType}")
2526
* .build()
2627
* </code></pre>
2728
* </div>
2829
*/
30+
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", defaultImpl = DiscountTypeCombinationImpl.class, visible = true)
31+
@JsonDeserialize(as = DiscountTypeCombinationImpl.class)
2932
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
3033
public interface DiscountTypeCombination {
3134

@@ -49,10 +52,30 @@ public static DiscountTypeCombination deepCopy(@Nullable final DiscountTypeCombi
4952
if (template == null) {
5053
return null;
5154
}
55+
56+
if (!(template instanceof DiscountTypeCombinationImpl)) {
57+
return template.copyDeep();
58+
}
5259
DiscountTypeCombinationImpl instance = new DiscountTypeCombinationImpl();
5360
return instance;
5461
}
5562

63+
/**
64+
* builder for bestDeal subtype
65+
* @return builder
66+
*/
67+
public static com.commercetools.history.models.common.BestDealBuilder bestDealBuilder() {
68+
return com.commercetools.history.models.common.BestDealBuilder.of();
69+
}
70+
71+
/**
72+
* builder for stacking subtype
73+
* @return builder
74+
*/
75+
public static com.commercetools.history.models.common.StackingBuilder stackingBuilder() {
76+
return com.commercetools.history.models.common.StackingBuilder.of();
77+
}
78+
5679
/**
5780
* accessor map function
5881
* @param <T> mapped type

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
1212
public class DiscountTypeCombinationBuilder {
1313

14+
public com.commercetools.history.models.common.BestDealBuilder bestDealBuilder() {
15+
return com.commercetools.history.models.common.BestDealBuilder.of();
16+
}
17+
18+
public com.commercetools.history.models.common.StackingBuilder stackingBuilder() {
19+
return com.commercetools.history.models.common.StackingBuilder.of();
20+
}
21+
1422
/**
1523
* factory method for an instance of DiscountTypeCombinationBuilder
1624
* @return builder

0 commit comments

Comments
 (0)