001 002package com.commercetools.api.models.error; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.constraints.NotNull; 010 011import com.fasterxml.jackson.annotation.*; 012import com.fasterxml.jackson.databind.annotation.*; 013 014import io.vrap.rmf.base.client.utils.Generated; 015 016/** 017 * <p>Returned when certain API-specific constraints were not met. For example, the specified Discount Code was never applied and cannot be updated.</p> 018 * 019 * <hr> 020 * Example to create an instance using the builder pattern 021 * <div class=code-example> 022 * <pre><code class='java'> 023 * InternalConstraintViolatedError internalConstraintViolatedError = InternalConstraintViolatedError.builder() 024 * .message("{message}") 025 * .build() 026 * </code></pre> 027 * </div> 028 */ 029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 030@JsonDeserialize(as = InternalConstraintViolatedErrorImpl.class) 031public interface InternalConstraintViolatedError extends ErrorObject { 032 033 /** 034 * discriminator value for InternalConstraintViolatedError 035 */ 036 String INTERNAL_CONSTRAINT_VIOLATED = "InternalConstraintViolated"; 037 038 /** 039 * 040 * @return code 041 */ 042 @NotNull 043 @JsonProperty("code") 044 public String getCode(); 045 046 /** 047 * <p>Plain text description of the constraints that were violated.</p> 048 * @return message 049 */ 050 @NotNull 051 @JsonProperty("message") 052 public String getMessage(); 053 054 /** 055 * <p>Plain text description of the constraints that were violated.</p> 056 * @param message value to be set 057 */ 058 059 public void setMessage(final String message); 060 061 /** 062 * factory method 063 * @return instance of InternalConstraintViolatedError 064 */ 065 public static InternalConstraintViolatedError of() { 066 return new InternalConstraintViolatedErrorImpl(); 067 } 068 069 /** 070 * factory method to create a shallow copy InternalConstraintViolatedError 071 * @param template instance to be copied 072 * @return copy instance 073 */ 074 public static InternalConstraintViolatedError of(final InternalConstraintViolatedError template) { 075 InternalConstraintViolatedErrorImpl instance = new InternalConstraintViolatedErrorImpl(); 076 instance.setMessage(template.getMessage()); 077 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 078 return instance; 079 } 080 081 /** 082 * factory method to create a deep copy of InternalConstraintViolatedError 083 * @param template instance to be copied 084 * @return copy instance 085 */ 086 @Nullable 087 public static InternalConstraintViolatedError deepCopy(@Nullable final InternalConstraintViolatedError template) { 088 if (template == null) { 089 return null; 090 } 091 InternalConstraintViolatedErrorImpl instance = new InternalConstraintViolatedErrorImpl(); 092 instance.setMessage(template.getMessage()); 093 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 094 return instance; 095 } 096 097 /** 098 * builder factory method for InternalConstraintViolatedError 099 * @return builder 100 */ 101 public static InternalConstraintViolatedErrorBuilder builder() { 102 return InternalConstraintViolatedErrorBuilder.of(); 103 } 104 105 /** 106 * create builder for InternalConstraintViolatedError instance 107 * @param template instance with prefilled values for the builder 108 * @return builder 109 */ 110 public static InternalConstraintViolatedErrorBuilder builder(final InternalConstraintViolatedError template) { 111 return InternalConstraintViolatedErrorBuilder.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 withInternalConstraintViolatedError(Function<InternalConstraintViolatedError, 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<InternalConstraintViolatedError> typeReference() { 129 return new com.fasterxml.jackson.core.type.TypeReference<InternalConstraintViolatedError>() { 130 @Override 131 public String toString() { 132 return "TypeReference<InternalConstraintViolatedError>"; 133 } 134 }; 135 } 136}