com.commercetools.history.models.change_value.AttributeValueBuilder 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 io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;
/**
* AttributeValueBuilder
*
* Example to create an instance using the builder pattern
*
*
* AttributeValue attributeValue = AttributeValue.builder()
* .name("{name}")
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class AttributeValueBuilder implements Builder {
private String name;
private java.lang.Object value;
/**
* Name of the Attribute set.
* @param name value to be set
* @return Builder
*/
public AttributeValueBuilder name(final String name) {
this.name = name;
return this;
}
/**
* Value set for the Attribute determined by the AttributeType:
*
* - For Enum Type and Localized Enum Type,
value
is the key
of the Plain Enum Value or Localized Enum Value objects, or the complete objects.
* - For Localizable Text Type,
value
is the LocalizedString object.
* - For Money Type Attributes,
value
is the Money object.
* - For Set Type Attributes,
value
is the entire set
object.
* - For Nested Type Attributes,
value
is the list of values of all Attributes of the nested Product.
* - For Reference Type Attributes,
value
is the Reference object.
*
* @param value value to be set
* @return Builder
*/
public AttributeValueBuilder value(final java.lang.Object value) {
this.value = value;
return this;
}
/**
* Name of the Attribute set.
* @return name
*/
public String getName() {
return this.name;
}
/**
* Value set for the Attribute determined by the AttributeType:
*
* - For Enum Type and Localized Enum Type,
value
is the key
of the Plain Enum Value or Localized Enum Value objects, or the complete objects.
* - For Localizable Text Type,
value
is the LocalizedString object.
* - For Money Type Attributes,
value
is the Money object.
* - For Set Type Attributes,
value
is the entire set
object.
* - For Nested Type Attributes,
value
is the list of values of all Attributes of the nested Product.
* - For Reference Type Attributes,
value
is the Reference object.
*
* @return value
*/
public java.lang.Object getValue() {
return this.value;
}
/**
* builds AttributeValue with checking for non-null required values
* @return AttributeValue
*/
public AttributeValue build() {
Objects.requireNonNull(name, AttributeValue.class + ": name is missing");
Objects.requireNonNull(value, AttributeValue.class + ": value is missing");
return new AttributeValueImpl(name, value);
}
/**
* builds AttributeValue without checking for non-null required values
* @return AttributeValue
*/
public AttributeValue buildUnchecked() {
return new AttributeValueImpl(name, value);
}
/**
* factory method for an instance of AttributeValueBuilder
* @return builder
*/
public static AttributeValueBuilder of() {
return new AttributeValueBuilder();
}
/**
* create builder for AttributeValue instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static AttributeValueBuilder of(final AttributeValue template) {
AttributeValueBuilder builder = new AttributeValueBuilder();
builder.name = template.getName();
builder.value = template.getValue();
return builder;
}
}