com.logicommerce.sdktest.definition.ConfigDefinitionFakeBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdktest Show documentation
Show all versions of sdktest Show documentation
Logicommerce SDK Testing tools for Logicommerce plugins.
package com.logicommerce.sdktest.definition;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.logicommerce.sdk.definition.implementations.MappedFieldDefinitionImpl;
public abstract class ConfigDefinitionFakeBuilder> {
private List> properties;
private boolean hasAdditionalProperties;
private List> additionalProperties;
private List> mappedFields;
protected ConfigDefinitionFakeBuilder() {
properties = new ArrayList<>();
additionalProperties = new ArrayList<>();
mappedFields = new ArrayList<>();
}
public PropertyDefinitionFakeBuilder property() {
PropertyDefinitionFakeBuilder property = new PropertyDefinitionFakeBuilder<>(returnThis());
properties.add(property);
return property;
}
public T hasAdditionalProperties(boolean hasAdditionalProperties) {
this.hasAdditionalProperties = hasAdditionalProperties;
return returnThis();
}
public PropertyDefinitionFakeBuilder additionalProperty() {
PropertyDefinitionFakeBuilder additionalProperty = new PropertyDefinitionFakeBuilder<>(returnThis());
properties.add(additionalProperty);
return additionalProperty;
}
public MappedFieldDefinitionImpl.Builder mappedField() {
MappedFieldDefinitionImpl.Builder mappedField = new MappedFieldDefinitionImpl.Builder<>(returnThis());
mappedFields.add(mappedField);
return mappedField;
}
public void setAttributes(ConfigDefinitionFake configDefinition) {
configDefinition
.setProperties(properties.stream().map(PropertyDefinitionFakeBuilder::build).collect(Collectors.toList()));
configDefinition.setHasAdditionalProperties(hasAdditionalProperties);
configDefinition.setAdditionalProperties(
additionalProperties.stream().map(PropertyDefinitionFakeBuilder::build).collect(Collectors.toList()));
configDefinition.setMappedFields(
mappedFields.stream().map(MappedFieldDefinitionImpl.Builder::build).collect(Collectors.toList()));
}
protected abstract T returnThis();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy