001 002package com.commercetools.api.models.order; 003 004import java.util.*; 005import java.util.function.Function; 006 007import io.vrap.rmf.base.client.Builder; 008import io.vrap.rmf.base.client.utils.Generated; 009 010/** 011 * OrderSearchExistsExpressionBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * OrderSearchExistsExpression orderSearchExistsExpression = OrderSearchExistsExpression.builder() 017 * .exists(existsBuilder -> existsBuilder) 018 * .build() 019 * </code></pre> 020 * </div> 021 */ 022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 023public class OrderSearchExistsExpressionBuilder implements Builder<OrderSearchExistsExpression> { 024 025 private com.commercetools.api.models.order.OrderSearchQueryExpressionValue exists; 026 027 /** 028 * set the value to the exists using the builder function 029 * @param builder function to build the exists value 030 * @return Builder 031 */ 032 033 public OrderSearchExistsExpressionBuilder exists( 034 Function<com.commercetools.api.models.order.OrderSearchQueryExpressionValueBuilder, com.commercetools.api.models.order.OrderSearchQueryExpressionValueBuilder> builder) { 035 this.exists = builder.apply(com.commercetools.api.models.order.OrderSearchQueryExpressionValueBuilder.of()) 036 .build(); 037 return this; 038 } 039 040 /** 041 * set the value to the exists using the builder function 042 * @param builder function to build the exists value 043 * @return Builder 044 */ 045 046 public OrderSearchExistsExpressionBuilder withExists( 047 Function<com.commercetools.api.models.order.OrderSearchQueryExpressionValueBuilder, com.commercetools.api.models.order.OrderSearchQueryExpressionValue> builder) { 048 this.exists = builder.apply(com.commercetools.api.models.order.OrderSearchQueryExpressionValueBuilder.of()); 049 return this; 050 } 051 052 /** 053 * set the value to the exists 054 * @param exists value to be set 055 * @return Builder 056 */ 057 058 public OrderSearchExistsExpressionBuilder exists( 059 final com.commercetools.api.models.order.OrderSearchQueryExpressionValue exists) { 060 this.exists = exists; 061 return this; 062 } 063 064 /** 065 * value of exists} 066 * @return exists 067 */ 068 069 public com.commercetools.api.models.order.OrderSearchQueryExpressionValue getExists() { 070 return this.exists; 071 } 072 073 /** 074 * builds OrderSearchExistsExpression with checking for non-null required values 075 * @return OrderSearchExistsExpression 076 */ 077 public OrderSearchExistsExpression build() { 078 Objects.requireNonNull(exists, OrderSearchExistsExpression.class + ": exists is missing"); 079 return new OrderSearchExistsExpressionImpl(exists); 080 } 081 082 /** 083 * builds OrderSearchExistsExpression without checking for non-null required values 084 * @return OrderSearchExistsExpression 085 */ 086 public OrderSearchExistsExpression buildUnchecked() { 087 return new OrderSearchExistsExpressionImpl(exists); 088 } 089 090 /** 091 * factory method for an instance of OrderSearchExistsExpressionBuilder 092 * @return builder 093 */ 094 public static OrderSearchExistsExpressionBuilder of() { 095 return new OrderSearchExistsExpressionBuilder(); 096 } 097 098 /** 099 * create builder for OrderSearchExistsExpression instance 100 * @param template instance with prefilled values for the builder 101 * @return builder 102 */ 103 public static OrderSearchExistsExpressionBuilder of(final OrderSearchExistsExpression template) { 104 OrderSearchExistsExpressionBuilder builder = new OrderSearchExistsExpressionBuilder(); 105 builder.exists = template.getExists(); 106 return builder; 107 } 108 109}