cd.go.contrib.plugins.configrepo.groovy.dsl.GitMaterial Maven / Gradle / Ivy
Show all versions of dsl Show documentation
// Generated by delombok at Sun Sep 29 21:39:48 PDT 2024
/*
* Copyright 2022 Thoughtworks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cd.go.contrib.plugins.configrepo.groovy.dsl;
import cd.go.contrib.plugins.configrepo.groovy.dsl.mixins.Configurable;
import com.fasterxml.jackson.annotation.JsonProperty;
import groovy.lang.Closure;
import groovy.lang.DelegatesTo;
import groovy.transform.stc.ClosureParams;
import groovy.transform.stc.SimpleType;
import jakarta.validation.constraints.NotEmpty;
import java.util.function.Consumer;
import static groovy.lang.Closure.DELEGATE_ONLY;
/**
* Represents a
* git material config.
*
* {@includeCode git.material.groovy}
*
* @see git material config
*/
public class GitMaterial extends ScmMaterial {
/**
* The url of the git repository.
*/
@JsonProperty("url")
@NotEmpty
private String url;
/**
* The git branch. Defaults to {@code master}.
*/
@JsonProperty("branch")
private String branch;
/**
* Add a {@code --depth=N} option to git cloning command on GoCD agent. Shallow clone truncates history to latest
* revisions, thus helps accelerating clone operation for repositories with long history.
*
* Clone depth is dynamically calculated to ensure revisions from GO_FROM_REVISION to GO_TO_REVISION are included
* in the cloned repository.
*/
@JsonProperty("shallow_clone")
private Boolean shallowClone;
public GitMaterial() {
this(null);
}
public GitMaterial(@DelegatesTo(value = GitMaterial.class, strategy = DELEGATE_ONLY) @ClosureParams(value = SimpleType.class, options = "cd.go.contrib.plugins.configrepo.groovy.dsl.GitMaterial") Closure> cl) {
this(null, cl);
}
public GitMaterial(String name, @DelegatesTo(value = GitMaterial.class, strategy = DELEGATE_ONLY) @ClosureParams(value = SimpleType.class, options = "cd.go.contrib.plugins.configrepo.groovy.dsl.GitMaterial") Closure> cl) {
super(name);
configure(cl);
}
public GitMaterial(String name, Consumer configure) {
super(name, configure);
}
@Override
public GitMaterial dup(@DelegatesTo(value = GitMaterial.class, strategy = DELEGATE_ONLY) @ClosureParams(value = SimpleType.class, options = "cd.go.contrib.plugins.configrepo.groovy.dsl.GitMaterial") Closure> config) {
return Configurable.applyTo(config, deepClone());
}
@Override
protected GitMaterial deepClone() {
return new GitMaterial(name, g -> {
injectSettings(g);
g.url = url;
g.branch = branch;
g.shallowClone = shallowClone;
});
}
/**
* The url of the git repository.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String getUrl() {
return this.url;
}
/**
* The git branch. Defaults to {@code master}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String getBranch() {
return this.branch;
}
/**
* Add a {@code --depth=N} option to git cloning command on GoCD agent. Shallow clone truncates history to latest
* revisions, thus helps accelerating clone operation for repositories with long history.
*
* Clone depth is dynamically calculated to ensure revisions from GO_FROM_REVISION to GO_TO_REVISION are included
* in the cloned repository.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public Boolean getShallowClone() {
return this.shallowClone;
}
/**
* The url of the git repository.
*/
@JsonProperty("url")
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setUrl(final String url) {
this.url = url;
}
/**
* The git branch. Defaults to {@code master}.
*/
@JsonProperty("branch")
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setBranch(final String branch) {
this.branch = branch;
}
/**
* Add a {@code --depth=N} option to git cloning command on GoCD agent. Shallow clone truncates history to latest
* revisions, thus helps accelerating clone operation for repositories with long history.
*
* Clone depth is dynamically calculated to ensure revisions from GO_FROM_REVISION to GO_TO_REVISION are included
* in the cloned repository.
*/
@JsonProperty("shallow_clone")
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setShallowClone(final Boolean shallowClone) {
this.shallowClone = shallowClone;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof GitMaterial)) return false;
final GitMaterial other = (GitMaterial) o;
if (!other.canEqual((java.lang.Object) this)) return false;
if (!super.equals(o)) return false;
final java.lang.Object this$shallowClone = this.getShallowClone();
final java.lang.Object other$shallowClone = other.getShallowClone();
if (this$shallowClone == null ? other$shallowClone != null : !this$shallowClone.equals(other$shallowClone)) return false;
final java.lang.Object this$url = this.getUrl();
final java.lang.Object other$url = other.getUrl();
if (this$url == null ? other$url != null : !this$url.equals(other$url)) return false;
final java.lang.Object this$branch = this.getBranch();
final java.lang.Object other$branch = other.getBranch();
if (this$branch == null ? other$branch != null : !this$branch.equals(other$branch)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected boolean canEqual(final java.lang.Object other) {
return other instanceof GitMaterial;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
final java.lang.Object $shallowClone = this.getShallowClone();
result = result * PRIME + ($shallowClone == null ? 43 : $shallowClone.hashCode());
final java.lang.Object $url = this.getUrl();
result = result * PRIME + ($url == null ? 43 : $url.hashCode());
final java.lang.Object $branch = this.getBranch();
result = result * PRIME + ($branch == null ? 43 : $branch.hashCode());
return result;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "GitMaterial(super=" + super.toString() + ", url=" + this.getUrl() + ", branch=" + this.getBranch() + ", shallowClone=" + this.getShallowClone() + ")";
}
}