All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.commercetools.history.models.common.AssociateBuilder Maven / Gradle / Ivy

There is a newer version: 17.15.1
Show newest version

package com.commercetools.history.models.common;

import java.util.*;
import java.util.function.Function;

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

/**
 * AssociateBuilder
 * 
* Example to create an instance using the builder pattern *
*

 *     Associate associate = Associate.builder()
 *             .plusAssociateRoleAssignments(associateRoleAssignmentsBuilder -> associateRoleAssignmentsBuilder)
 *             .customer(customerBuilder -> customerBuilder)
 *             .build()
 * 
*
*/ @Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") public class AssociateBuilder implements Builder { private java.util.List associateRoleAssignments; private com.commercetools.history.models.common.Reference customer; /** * set values to the associateRoleAssignments * @param associateRoleAssignments value to be set * @return Builder */ public AssociateBuilder associateRoleAssignments( final com.commercetools.history.models.common.AssociateRoleAssignment... associateRoleAssignments) { this.associateRoleAssignments = new ArrayList<>(Arrays.asList(associateRoleAssignments)); return this; } /** * set value to the associateRoleAssignments * @param associateRoleAssignments value to be set * @return Builder */ public AssociateBuilder associateRoleAssignments( final java.util.List associateRoleAssignments) { this.associateRoleAssignments = associateRoleAssignments; return this; } /** * add values to the associateRoleAssignments * @param associateRoleAssignments value to be set * @return Builder */ public AssociateBuilder plusAssociateRoleAssignments( final com.commercetools.history.models.common.AssociateRoleAssignment... associateRoleAssignments) { if (this.associateRoleAssignments == null) { this.associateRoleAssignments = new ArrayList<>(); } this.associateRoleAssignments.addAll(Arrays.asList(associateRoleAssignments)); return this; } /** * add the value to the associateRoleAssignments using the builder function * @param builder function to build the associateRoleAssignments value * @return Builder */ public AssociateBuilder plusAssociateRoleAssignments( Function builder) { if (this.associateRoleAssignments == null) { this.associateRoleAssignments = new ArrayList<>(); } this.associateRoleAssignments.add( builder.apply(com.commercetools.history.models.common.AssociateRoleAssignmentBuilder.of()).build()); return this; } /** * set the value to the associateRoleAssignments using the builder function * @param builder function to build the associateRoleAssignments value * @return Builder */ public AssociateBuilder withAssociateRoleAssignments( Function builder) { this.associateRoleAssignments = new ArrayList<>(); this.associateRoleAssignments.add( builder.apply(com.commercetools.history.models.common.AssociateRoleAssignmentBuilder.of()).build()); return this; } /** * add the value to the associateRoleAssignments using the builder function * @param builder function to build the associateRoleAssignments value * @return Builder */ public AssociateBuilder addAssociateRoleAssignments( Function builder) { return plusAssociateRoleAssignments( builder.apply(com.commercetools.history.models.common.AssociateRoleAssignmentBuilder.of())); } /** * set the value to the associateRoleAssignments using the builder function * @param builder function to build the associateRoleAssignments value * @return Builder */ public AssociateBuilder setAssociateRoleAssignments( Function builder) { return associateRoleAssignments( builder.apply(com.commercetools.history.models.common.AssociateRoleAssignmentBuilder.of())); } /** * set the value to the customer using the builder function * @param builder function to build the customer value * @return Builder */ public AssociateBuilder customer( Function builder) { this.customer = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build(); return this; } /** * set the value to the customer using the builder function * @param builder function to build the customer value * @return Builder */ public AssociateBuilder withCustomer( Function builder) { this.customer = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()); return this; } /** * set the value to the customer * @param customer value to be set * @return Builder */ public AssociateBuilder customer(final com.commercetools.history.models.common.Reference customer) { this.customer = customer; return this; } /** * value of associateRoleAssignments} * @return associateRoleAssignments */ public java.util.List getAssociateRoleAssignments() { return this.associateRoleAssignments; } /** * value of customer} * @return customer */ public com.commercetools.history.models.common.Reference getCustomer() { return this.customer; } /** * builds Associate with checking for non-null required values * @return Associate */ public Associate build() { Objects.requireNonNull(associateRoleAssignments, Associate.class + ": associateRoleAssignments is missing"); Objects.requireNonNull(customer, Associate.class + ": customer is missing"); return new AssociateImpl(associateRoleAssignments, customer); } /** * builds Associate without checking for non-null required values * @return Associate */ public Associate buildUnchecked() { return new AssociateImpl(associateRoleAssignments, customer); } /** * factory method for an instance of AssociateBuilder * @return builder */ public static AssociateBuilder of() { return new AssociateBuilder(); } /** * create builder for Associate instance * @param template instance with prefilled values for the builder * @return builder */ public static AssociateBuilder of(final Associate template) { AssociateBuilder builder = new AssociateBuilder(); builder.associateRoleAssignments = template.getAssociateRoleAssignments(); builder.customer = template.getCustomer(); return builder; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy