All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.atlassian.bamboo.specs.api.model.jobcache.JobCacheProperties Maven / Gradle / Ivy

There is a newer version: 2.1.7
Show newest version
package com.atlassian.bamboo.specs.api.model.jobcache;

import com.atlassian.bamboo.specs.api.builders.jobcache.JobCache;
import com.atlassian.bamboo.specs.api.codegen.annotations.Builder;
import com.atlassian.bamboo.specs.api.codegen.annotations.CodeGenerator;
import com.atlassian.bamboo.specs.api.model.AtlassianModuleProperties;
import com.atlassian.bamboo.specs.api.model.plan.configuration.PluginConfigurationProperties;
import com.atlassian.bamboo.specs.api.validators.common.ValidationContext;
import com.atlassian.bamboo.specs.codegen.emitters.jobcache.JobCacheEmitter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@Builder(JobCache.class)
@CodeGenerator(JobCacheEmitter.class)
public class JobCacheProperties implements PluginConfigurationProperties {

    public static final ValidationContext VALIDATION_CONTEXT = ValidationContext.of("Job Cache");

    private List caches = new ArrayList<>();

    private JobCacheProperties() {}

    public JobCacheProperties(List caches) {
        this.caches = caches;
        validate();
    }

    public List getCaches() {
        return caches;
    }

    @Override
    public AtlassianModuleProperties getAtlassianPlugin() {
        return new AtlassianModuleProperties("com.atlassian.buildeng.bamboo-job-cache-plugin:jobCachePreBuild");
    }

    @Override
    public final void validate() {
        if (caches != null) {
            caches.forEach((CacheItemProperties t) -> {
                t.validate();
            });
        }
    }

    @Override
    public int hashCode() {
        return Objects.hash(caches);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final JobCacheProperties other = (JobCacheProperties) obj;
        if (!Objects.equals(this.caches, other.caches)) {
            return false;
        }
        return true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy