Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ public interface DayOfMonthSchedule extends RecurrencePolicySchedule {
*/
String DAY_OF_MONTH = "dayOfMonth";

/**
*
* @return type
*/
@NotNull
@JsonProperty("type")
public String getType();

/**
* <p>The day of the month when the Recurring Order is created. If the value is greater than the number of days in a given month, the order is created on the last day of the month.</p>
* @return day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@
* </code></pre>
* </div>
*/
@io.vrap.rmf.base.client.utils.json.SubType("dayOfMonth")
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
@JsonDeserialize(as = DayOfMonthScheduleDraftImpl.class)
public interface DayOfMonthScheduleDraft
extends RecurrencePolicyScheduleDraft, io.vrap.rmf.base.client.Draft<DayOfMonthScheduleDraft> {

/**
*
* @return type
* discriminator value for DayOfMonthScheduleDraft
*/
@NotNull
@JsonProperty("type")
public String getType();
String DAY_OF_MONTH = "dayOfMonth";

/**
* <p>The day of the month when the Recurring Order should be created. If the value is greater than the number of days in a given month, the order will be created on the last day of the month.</p>
Expand All @@ -58,6 +57,25 @@ public interface DayOfMonthScheduleDraft

public void setDay(final Integer day);

/**
* factory method
* @return instance of DayOfMonthScheduleDraft
*/
public static DayOfMonthScheduleDraft of() {
return new DayOfMonthScheduleDraftImpl();
}

/**
* factory method to create a shallow copy DayOfMonthScheduleDraft
* @param template instance to be copied
* @return copy instance
*/
public static DayOfMonthScheduleDraft of(final DayOfMonthScheduleDraft template) {
DayOfMonthScheduleDraftImpl instance = new DayOfMonthScheduleDraftImpl();
instance.setDay(template.getDay());
return instance;
}

public DayOfMonthScheduleDraft copyDeep();

/**
Expand All @@ -75,6 +93,23 @@ public static DayOfMonthScheduleDraft deepCopy(@Nullable final DayOfMonthSchedul
return instance;
}

/**
* builder factory method for DayOfMonthScheduleDraft
* @return builder
*/
public static DayOfMonthScheduleDraftBuilder builder() {
return DayOfMonthScheduleDraftBuilder.of();
}

/**
* create builder for DayOfMonthScheduleDraft instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static DayOfMonthScheduleDraftBuilder builder(final DayOfMonthScheduleDraft template) {
return DayOfMonthScheduleDraftBuilder.of(template);
}

/**
* accessor map function
* @param <T> mapped type
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@

package com.commercetools.api.models.recurrence_policy;

import java.util.*;

import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;

/**
* DayOfMonthScheduleDraftBuilder
* <hr>
* Example to create an instance using the builder pattern
* <div class=code-example>
* <pre><code class='java'>
* DayOfMonthScheduleDraft dayOfMonthScheduleDraft = DayOfMonthScheduleDraft.builder()
* .day(1)
* .build()
* </code></pre>
* </div>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class DayOfMonthScheduleDraftBuilder implements Builder<DayOfMonthScheduleDraft> {

private Integer day;

/**
* <p>The day of the month when the Recurring Order should be created. If the value is greater than the number of days in a given month, the order will be created on the last day of the month.</p>
* @param day value to be set
* @return Builder
*/

public DayOfMonthScheduleDraftBuilder day(final Integer day) {
this.day = day;
return this;
}

/**
* <p>The day of the month when the Recurring Order should be created. If the value is greater than the number of days in a given month, the order will be created on the last day of the month.</p>
* @return day
*/

public Integer getDay() {
return this.day;
}

/**
* builds DayOfMonthScheduleDraft with checking for non-null required values
* @return DayOfMonthScheduleDraft
*/
public DayOfMonthScheduleDraft build() {
Objects.requireNonNull(day, DayOfMonthScheduleDraft.class + ": day is missing");
return new DayOfMonthScheduleDraftImpl(day);
}

/**
* builds DayOfMonthScheduleDraft without checking for non-null required values
* @return DayOfMonthScheduleDraft
*/
public DayOfMonthScheduleDraft buildUnchecked() {
return new DayOfMonthScheduleDraftImpl(day);
}

/**
* factory method for an instance of DayOfMonthScheduleDraftBuilder
* @return builder
*/
public static DayOfMonthScheduleDraftBuilder of() {
return new DayOfMonthScheduleDraftBuilder();
}

/**
* create builder for DayOfMonthScheduleDraft instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static DayOfMonthScheduleDraftBuilder of(final DayOfMonthScheduleDraft template) {
DayOfMonthScheduleDraftBuilder builder = new DayOfMonthScheduleDraftBuilder();
builder.day = template.getDay();
return builder;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ public class DayOfMonthScheduleDraftImpl implements DayOfMonthScheduleDraft, Mod
* create instance with all properties
*/
@JsonCreator
DayOfMonthScheduleDraftImpl(@JsonProperty("type") final String type, @JsonProperty("day") final Integer day) {
this.type = type;
DayOfMonthScheduleDraftImpl(@JsonProperty("day") final Integer day) {
this.day = day;
this.type = DAY_OF_MONTH;
}

/**
* create empty instance
*/
public DayOfMonthScheduleDraftImpl() {
this.type = DAY_OF_MONTH;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
* Example to create a subtype instance using the builder pattern
* <div class=code-example>
* <pre><code class='java'>
* RecurrencePolicyScheduleDraft recurrencePolicyScheduleDraft = RecurrencePolicyScheduleDraft.standardBuilder()
* value(0.3)
* intervalUnit(IntervalUnit.DAYS)
* RecurrencePolicyScheduleDraft recurrencePolicyScheduleDraft = RecurrencePolicyScheduleDraft.dayOfMonthBuilder()
* day(1)
* .build()
* </code></pre>
* </div>
Expand Down Expand Up @@ -61,6 +60,14 @@ public static RecurrencePolicyScheduleDraft deepCopy(@Nullable final RecurrenceP
return instance;
}

/**
* builder for dayOfMonth subtype
* @return builder
*/
public static com.commercetools.api.models.recurrence_policy.DayOfMonthScheduleDraftBuilder dayOfMonthBuilder() {
return com.commercetools.api.models.recurrence_policy.DayOfMonthScheduleDraftBuilder.of();
}

/**
* builder for standard subtype
* @return builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class RecurrencePolicyScheduleDraftBuilder {

public com.commercetools.api.models.recurrence_policy.DayOfMonthScheduleDraftBuilder dayOfMonthBuilder() {
return com.commercetools.api.models.recurrence_policy.DayOfMonthScheduleDraftBuilder.of();
}

public com.commercetools.api.models.recurrence_policy.StandardScheduleDraftBuilder standardBuilder() {
return com.commercetools.api.models.recurrence_policy.StandardScheduleDraftBuilder.of();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public StringComparisonPredicateBuilder<RecurrencePolicyScheduleDraftQueryBuilde
p -> new CombinationQueryPredicate<>(p, RecurrencePolicyScheduleDraftQueryBuilderDsl::of));
}

public CombinationQueryPredicate<RecurrencePolicyScheduleDraftQueryBuilderDsl> asDayOfMonthScheduleDraft(
public CombinationQueryPredicate<RecurrencePolicyScheduleDraftQueryBuilderDsl> asDayOfMonth(
Function<com.commercetools.api.predicates.query.recurrence_policy.DayOfMonthScheduleDraftQueryBuilderDsl, CombinationQueryPredicate<com.commercetools.api.predicates.query.recurrence_policy.DayOfMonthScheduleDraftQueryBuilderDsl>> fn) {
return new CombinationQueryPredicate<>(
fn.apply(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

package com.commercetools.api.models.recurrence_policy;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

public class DayOfMonthScheduleDraftTest {

@ParameterizedTest(name = "#{index} with {0}")
@MethodSource("objectBuilder")
public void buildUnchecked(String name, DayOfMonthScheduleDraftBuilder builder) {
DayOfMonthScheduleDraft dayOfMonthScheduleDraft = builder.buildUnchecked();
Assertions.assertThat(dayOfMonthScheduleDraft).isInstanceOf(DayOfMonthScheduleDraft.class);
}

public static Object[][] objectBuilder() {
return new Object[][] { new Object[] { "day", DayOfMonthScheduleDraft.builder().day(5) } };
}

@Test
public void day() {
DayOfMonthScheduleDraft value = DayOfMonthScheduleDraft.of();
value.setDay(5);
Assertions.assertThat(value.getDay()).isEqualTo(5);
}
}
1 change: 1 addition & 0 deletions references.txt
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,4 @@ c12d33dda145602c607dcf1bb77f503f4508a1ee
cd07396232802b1c29238fb92214946462f19e5d
75be7d69ebbeef0c07001c09c4c84e318aead40c
53775bb9cfdee1169d81256fcf9b33ce5718b6e5
0e52ed3672e48fed855eed94497de9b16e7a50fa