001 002package com.commercetools.history.models.common; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007import java.util.stream.Collectors; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * PaymentInfo 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * PaymentInfo paymentInfo = PaymentInfo.builder() 026 * .plusPayments(paymentsBuilder -> paymentsBuilder) 027 * .build() 028 * </code></pre> 029 * </div> 030 */ 031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 032@JsonDeserialize(as = PaymentInfoImpl.class) 033public interface PaymentInfo { 034 035 /** 036 * 037 * @return payments 038 */ 039 @NotNull 040 @Valid 041 @JsonProperty("payments") 042 public List<Reference> getPayments(); 043 044 /** 045 * set payments 046 * @param payments values to be set 047 */ 048 049 @JsonIgnore 050 public void setPayments(final Reference... payments); 051 052 /** 053 * set payments 054 * @param payments values to be set 055 */ 056 057 public void setPayments(final List<Reference> payments); 058 059 /** 060 * factory method 061 * @return instance of PaymentInfo 062 */ 063 public static PaymentInfo of() { 064 return new PaymentInfoImpl(); 065 } 066 067 /** 068 * factory method to create a shallow copy PaymentInfo 069 * @param template instance to be copied 070 * @return copy instance 071 */ 072 public static PaymentInfo of(final PaymentInfo template) { 073 PaymentInfoImpl instance = new PaymentInfoImpl(); 074 instance.setPayments(template.getPayments()); 075 return instance; 076 } 077 078 /** 079 * factory method to create a deep copy of PaymentInfo 080 * @param template instance to be copied 081 * @return copy instance 082 */ 083 @Nullable 084 public static PaymentInfo deepCopy(@Nullable final PaymentInfo template) { 085 if (template == null) { 086 return null; 087 } 088 PaymentInfoImpl instance = new PaymentInfoImpl(); 089 instance.setPayments(Optional.ofNullable(template.getPayments()) 090 .map(t -> t.stream() 091 .map(com.commercetools.history.models.common.Reference::deepCopy) 092 .collect(Collectors.toList())) 093 .orElse(null)); 094 return instance; 095 } 096 097 /** 098 * builder factory method for PaymentInfo 099 * @return builder 100 */ 101 public static PaymentInfoBuilder builder() { 102 return PaymentInfoBuilder.of(); 103 } 104 105 /** 106 * create builder for PaymentInfo instance 107 * @param template instance with prefilled values for the builder 108 * @return builder 109 */ 110 public static PaymentInfoBuilder builder(final PaymentInfo template) { 111 return PaymentInfoBuilder.of(template); 112 } 113 114 /** 115 * accessor map function 116 * @param <T> mapped type 117 * @param helper function to map the object 118 * @return mapped value 119 */ 120 default <T> T withPaymentInfo(Function<PaymentInfo, T> helper) { 121 return helper.apply(this); 122 } 123 124 /** 125 * gives a TypeReference for usage with Jackson DataBind 126 * @return TypeReference 127 */ 128 public static com.fasterxml.jackson.core.type.TypeReference<PaymentInfo> typeReference() { 129 return new com.fasterxml.jackson.core.type.TypeReference<PaymentInfo>() { 130 @Override 131 public String toString() { 132 return "TypeReference<PaymentInfo>"; 133 } 134 }; 135 } 136}