/** * Creates a new object initialized with the given values. * * @param value initial value for the {@link Price#getValue()} property * @return new object initialized with the given values */ public static PriceBuilder of(final MonetaryAmount value) { return new PriceBuilder(null, null, null, null, null, null, null, null, null, value); }
public Price withCustomerGroup(final Optional<Reference<CustomerGroup>> customerGroup) { return PriceBuilder.of(this).customerGroup(customerGroup).build(); }
public static PriceBuilder of(final Price template) { return of(template.getValue()) .country(template.getCountry()) .customerGroup(template.getCustomerGroup()) .channel(template.getChannel()) .discounted(template.getDiscounted()) .validFrom(template.getValidFrom()) .validUntil(template.getValidUntil()) .id(template.getId()); }
public static PriceBuilder of(final Price template) { return of(template.getValue()) .country(template.getCountry()) .customerGroup(template.getCustomerGroup()) .channel(template.getChannel()) .discounted(template.getDiscounted()); }
public Price withDiscounted(final Optional<DiscountedPrice> discounted) { return PriceBuilder.of(this).discounted(discounted).build(); }
public Price withValidUntil(final ZonedDateTime validUntil) { return PriceBuilder.of(this).validUntil(validUntil).build(); }
public PriceBuilder discounted(final DiscountedPrice discounted) { Objects.requireNonNull(discounted); return discounted(Optional.of(discounted)); }
public PriceBuilder channel(final Referenceable<Channel> channel) { Objects.requireNonNull(channel); return channel(Optional.of(channel.toReference())); }
public PriceBuilder customerGroup(final Referenceable<CustomerGroup> customerGroup) { Objects.requireNonNull(customerGroup); return customerGroup(Optional.of(customerGroup.toReference())); }
public PriceBuilder country(final CountryCode country) { Objects.requireNonNull(country); return country(Optional.of(country)); }
public static PriceBuilder of(final Price template) { return of(template.getValue()) .country(template.getCountry()) .customerGroup(template.getCustomerGroup()) .channel(template.getChannel()) .discounted(template.getDiscounted()); }
public Price withCustomerGroup(final Optional<Reference<CustomerGroup>> customerGroup) { return PriceBuilder.of(this).customerGroup(customerGroup).build(); }
public Price withDiscounted(final Optional<DiscountedPrice> discounted) { return PriceBuilder.of(this).discounted(discounted).build(); }