com.commercetools.history.models.change_value.LocalizedEnumValueBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commercetools-sdk-java-history Show documentation
Show all versions of commercetools-sdk-java-history Show documentation
The e-commerce SDK from commercetools Composable Commerce for Java
package com.commercetools.history.models.change_value;
import java.util.*;
import java.util.function.Function;
import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;
/**
* LocalizedEnumValueBuilder
*
* Example to create an instance using the builder pattern
*
*
* LocalizedEnumValue localizedEnumValue = LocalizedEnumValue.builder()
* .key("{key}")
* .label(labelBuilder -> labelBuilder)
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class LocalizedEnumValueBuilder implements Builder {
private String key;
private com.commercetools.history.models.common.LocalizedString label;
/**
* Key of the value used as a programmatic identifier.
* @param key value to be set
* @return Builder
*/
public LocalizedEnumValueBuilder key(final String key) {
this.key = key;
return this;
}
/**
* Descriptive localized label of the value.
* @param builder function to build the label value
* @return Builder
*/
public LocalizedEnumValueBuilder label(
Function builder) {
this.label = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build();
return this;
}
/**
* Descriptive localized label of the value.
* @param builder function to build the label value
* @return Builder
*/
public LocalizedEnumValueBuilder withLabel(
Function builder) {
this.label = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of());
return this;
}
/**
* Descriptive localized label of the value.
* @param label value to be set
* @return Builder
*/
public LocalizedEnumValueBuilder label(final com.commercetools.history.models.common.LocalizedString label) {
this.label = label;
return this;
}
/**
* Key of the value used as a programmatic identifier.
* @return key
*/
public String getKey() {
return this.key;
}
/**
* Descriptive localized label of the value.
* @return label
*/
public com.commercetools.history.models.common.LocalizedString getLabel() {
return this.label;
}
/**
* builds LocalizedEnumValue with checking for non-null required values
* @return LocalizedEnumValue
*/
public LocalizedEnumValue build() {
Objects.requireNonNull(key, LocalizedEnumValue.class + ": key is missing");
Objects.requireNonNull(label, LocalizedEnumValue.class + ": label is missing");
return new LocalizedEnumValueImpl(key, label);
}
/**
* builds LocalizedEnumValue without checking for non-null required values
* @return LocalizedEnumValue
*/
public LocalizedEnumValue buildUnchecked() {
return new LocalizedEnumValueImpl(key, label);
}
/**
* factory method for an instance of LocalizedEnumValueBuilder
* @return builder
*/
public static LocalizedEnumValueBuilder of() {
return new LocalizedEnumValueBuilder();
}
/**
* create builder for LocalizedEnumValue instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static LocalizedEnumValueBuilder of(final LocalizedEnumValue template) {
LocalizedEnumValueBuilder builder = new LocalizedEnumValueBuilder();
builder.key = template.getKey();
builder.label = template.getLabel();
return builder;
}
}