io.sphere.sdk.commands.UpdateCommandDslBuilder Maven / Gradle / Ivy
package io.sphere.sdk.commands;
import com.fasterxml.jackson.core.type.TypeReference;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.ResourceView;
import io.sphere.sdk.models.Versioned;
import java.util.List;
import java.util.function.Function;
import static java.util.Objects.requireNonNull;
/**
* Internal class.
*/
public class UpdateCommandDslBuilder, C extends UpdateCommandDsl> extends Base implements Builder{
private Versioned versioned;
private List extends UpdateAction> updateActions;
private TypeReference typeReference;
private String baseEndpointWithoutId;
private Function, C> creationFunction;
private UpdateCommandDslBuilder(final Versioned versioned, final List extends UpdateAction> updateActions,
final TypeReference typeReference, final String baseEndpointWithoutId,
final Function, C> creationFunction) {
this.creationFunction = requireNonNull(creationFunction);
this.versioned = requireNonNull(versioned);
this.updateActions = requireNonNull(updateActions);
this.typeReference = requireNonNull(typeReference);
this.baseEndpointWithoutId = requireNonNull(baseEndpointWithoutId);
}
UpdateCommandDslBuilder(final UpdateCommandDslImpl template){
this(template.getVersioned(), template.getUpdateActions(), template.getTypeReference(), template.getBaseEndpointWithoutId(), template.getCreationFunction());
}
public static , C extends UpdateCommandDsl> UpdateCommandDslBuilder of(final Versioned versioned, final List extends UpdateAction> updateActions, final TypeReference typeReference, final String baseEndpointWithoutId, final Function, C> creationFunction) {
return new UpdateCommandDslBuilder<>(versioned, updateActions, typeReference, baseEndpointWithoutId, creationFunction);
}
public UpdateCommandDslBuilder versioned(final Versioned versioned) {
this.versioned = versioned;
return this;
}
@Override
public C build() {
return creationFunction.apply(this);
}
String getBaseEndpointWithoutId() {
return baseEndpointWithoutId;
}
Function, C> getCreationFunction() {
return creationFunction;
}
TypeReference getTypeReference() {
return typeReference;
}
List extends UpdateAction> getUpdateActions() {
return updateActions;
}
Versioned getVersioned() {
return versioned;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy