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 * InheritedAssociate 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * InheritedAssociate inheritedAssociate = InheritedAssociate.builder() 026 * .plusAssociateRoleAssignments(associateRoleAssignmentsBuilder -> associateRoleAssignmentsBuilder) 027 * .customer(customerBuilder -> customerBuilder) 028 * .build() 029 * </code></pre> 030 * </div> 031 */ 032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 033@JsonDeserialize(as = InheritedAssociateImpl.class) 034public interface InheritedAssociate { 035 036 /** 037 * 038 * @return associateRoleAssignments 039 */ 040 @NotNull 041 @Valid 042 @JsonProperty("associateRoleAssignments") 043 public List<InheritedAssociateRoleAssignment> getAssociateRoleAssignments(); 044 045 /** 046 * 047 * @return customer 048 */ 049 @NotNull 050 @Valid 051 @JsonProperty("customer") 052 public Reference getCustomer(); 053 054 /** 055 * set associateRoleAssignments 056 * @param associateRoleAssignments values to be set 057 */ 058 059 @JsonIgnore 060 public void setAssociateRoleAssignments(final InheritedAssociateRoleAssignment... associateRoleAssignments); 061 062 /** 063 * set associateRoleAssignments 064 * @param associateRoleAssignments values to be set 065 */ 066 067 public void setAssociateRoleAssignments(final List<InheritedAssociateRoleAssignment> associateRoleAssignments); 068 069 /** 070 * set customer 071 * @param customer value to be set 072 */ 073 074 public void setCustomer(final Reference customer); 075 076 /** 077 * factory method 078 * @return instance of InheritedAssociate 079 */ 080 public static InheritedAssociate of() { 081 return new InheritedAssociateImpl(); 082 } 083 084 /** 085 * factory method to create a shallow copy InheritedAssociate 086 * @param template instance to be copied 087 * @return copy instance 088 */ 089 public static InheritedAssociate of(final InheritedAssociate template) { 090 InheritedAssociateImpl instance = new InheritedAssociateImpl(); 091 instance.setAssociateRoleAssignments(template.getAssociateRoleAssignments()); 092 instance.setCustomer(template.getCustomer()); 093 return instance; 094 } 095 096 /** 097 * factory method to create a deep copy of InheritedAssociate 098 * @param template instance to be copied 099 * @return copy instance 100 */ 101 @Nullable 102 public static InheritedAssociate deepCopy(@Nullable final InheritedAssociate template) { 103 if (template == null) { 104 return null; 105 } 106 InheritedAssociateImpl instance = new InheritedAssociateImpl(); 107 instance.setAssociateRoleAssignments(Optional.ofNullable(template.getAssociateRoleAssignments()) 108 .map(t -> t.stream() 109 .map(com.commercetools.history.models.common.InheritedAssociateRoleAssignment::deepCopy) 110 .collect(Collectors.toList())) 111 .orElse(null)); 112 instance.setCustomer(com.commercetools.history.models.common.Reference.deepCopy(template.getCustomer())); 113 return instance; 114 } 115 116 /** 117 * builder factory method for InheritedAssociate 118 * @return builder 119 */ 120 public static InheritedAssociateBuilder builder() { 121 return InheritedAssociateBuilder.of(); 122 } 123 124 /** 125 * create builder for InheritedAssociate instance 126 * @param template instance with prefilled values for the builder 127 * @return builder 128 */ 129 public static InheritedAssociateBuilder builder(final InheritedAssociate template) { 130 return InheritedAssociateBuilder.of(template); 131 } 132 133 /** 134 * accessor map function 135 * @param <T> mapped type 136 * @param helper function to map the object 137 * @return mapped value 138 */ 139 default <T> T withInheritedAssociate(Function<InheritedAssociate, T> helper) { 140 return helper.apply(this); 141 } 142 143 /** 144 * gives a TypeReference for usage with Jackson DataBind 145 * @return TypeReference 146 */ 147 public static com.fasterxml.jackson.core.type.TypeReference<InheritedAssociate> typeReference() { 148 return new com.fasterxml.jackson.core.type.TypeReference<InheritedAssociate>() { 149 @Override 150 public String toString() { 151 return "TypeReference<InheritedAssociate>"; 152 } 153 }; 154 } 155}