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

org.apache.maven.model.DistributionManagement Maven / Gradle / Ivy

The newest version!
// =================== DO NOT EDIT THIS FILE ====================
//  Generated by Modello Velocity from model-v3.vm
//  template, any modifications will be overwritten.
// ==============================================================
package org.apache.maven.model;

import java.io.Serializable;
import java.util.AbstractList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.maven.api.annotations.Generated;
import org.apache.maven.api.annotations.Nonnull;

@Generated
public class DistributionManagement
    extends BaseObject
{

    public DistributionManagement() {
        this(org.apache.maven.api.model.DistributionManagement.newInstance());
    }

    public DistributionManagement(org.apache.maven.api.model.DistributionManagement delegate) {
        this(delegate, null);
    }

    public DistributionManagement(org.apache.maven.api.model.DistributionManagement delegate, BaseObject parent) {
        super(delegate, parent);
    }

    public DistributionManagement clone(){
        return new DistributionManagement(getDelegate());
    }

    public org.apache.maven.api.model.DistributionManagement getDelegate() {
        return (org.apache.maven.api.model.DistributionManagement) super.getDelegate();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || !(o instanceof DistributionManagement)) {
            return false;
        }
        DistributionManagement that = (DistributionManagement) o;
        return Objects.equals(this.delegate, that.delegate);
    }

    @Override
    public int hashCode() {
        return getDelegate().hashCode();
    }

    public DeploymentRepository getRepository() {
        return getDelegate().getRepository() != null ? new DeploymentRepository(getDelegate().getRepository(), this) : null;
    }

    public void setRepository(DeploymentRepository repository) {
        if (!Objects.equals(repository, getRepository())){
            if (repository != null) {
                update(getDelegate().withRepository(repository.getDelegate()));
                repository.childrenTracking = this::replace;
            } else {
                update(getDelegate().withRepository(null));
            }
        }
    }

    public DeploymentRepository getSnapshotRepository() {
        return getDelegate().getSnapshotRepository() != null ? new DeploymentRepository(getDelegate().getSnapshotRepository(), this) : null;
    }

    public void setSnapshotRepository(DeploymentRepository snapshotRepository) {
        if (!Objects.equals(snapshotRepository, getSnapshotRepository())){
            if (snapshotRepository != null) {
                update(getDelegate().withSnapshotRepository(snapshotRepository.getDelegate()));
                snapshotRepository.childrenTracking = this::replace;
            } else {
                update(getDelegate().withSnapshotRepository(null));
            }
        }
    }

    public Site getSite() {
        return getDelegate().getSite() != null ? new Site(getDelegate().getSite(), this) : null;
    }

    public void setSite(Site site) {
        if (!Objects.equals(site, getSite())){
            if (site != null) {
                update(getDelegate().withSite(site.getDelegate()));
                site.childrenTracking = this::replace;
            } else {
                update(getDelegate().withSite(null));
            }
        }
    }

    public String getDownloadUrl() {
        return getDelegate().getDownloadUrl();
    }

    public void setDownloadUrl(String downloadUrl) {
        if (!Objects.equals(downloadUrl, getDownloadUrl())) {
            update(getDelegate().withDownloadUrl(downloadUrl));
        }
    }

    public Relocation getRelocation() {
        return getDelegate().getRelocation() != null ? new Relocation(getDelegate().getRelocation(), this) : null;
    }

    public void setRelocation(Relocation relocation) {
        if (!Objects.equals(relocation, getRelocation())){
            if (relocation != null) {
                update(getDelegate().withRelocation(relocation.getDelegate()));
                relocation.childrenTracking = this::replace;
            } else {
                update(getDelegate().withRelocation(null));
            }
        }
    }

    public String getStatus() {
        return getDelegate().getStatus();
    }

    public void setStatus(String status) {
        if (!Objects.equals(status, getStatus())) {
            update(getDelegate().withStatus(status));
        }
    }

    public InputLocation getLocation(Object key) {
        org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
        return loc != null ? new InputLocation(loc) : null;
    }

    public void setLocation(Object key, InputLocation location) {
        update(org.apache.maven.api.model.DistributionManagement.newBuilder(getDelegate(), true)
                        .location(key, location.toApiLocation()).build());
    }

    public InputLocation getImportedFrom() {
        org.apache.maven.api.model.InputLocation loc = getDelegate().getImportedFrom();
        return loc != null ? new InputLocation(loc) : null;
    }

    public void setImportedFrom(InputLocation location) {
        update(org.apache.maven.api.model.DistributionManagement.newBuilder(getDelegate(), true)
                        .importedFrom(location.toApiLocation()).build());
    }

    public Set getLocationKeys() {
        return getDelegate().getLocationKeys();
    }

    protected boolean replace(Object oldDelegate, Object newDelegate) {
        if (super.replace(oldDelegate, newDelegate)) {
            return true;
        }
        if (oldDelegate == getDelegate().getRepository()) {
            update(getDelegate().withRepository((org.apache.maven.api.model.DeploymentRepository) newDelegate));
            return true;
        }
        if (oldDelegate == getDelegate().getSnapshotRepository()) {
            update(getDelegate().withSnapshotRepository((org.apache.maven.api.model.DeploymentRepository) newDelegate));
            return true;
        }
        if (oldDelegate == getDelegate().getSite()) {
            update(getDelegate().withSite((org.apache.maven.api.model.Site) newDelegate));
            return true;
        }
        if (oldDelegate == getDelegate().getRelocation()) {
            update(getDelegate().withRelocation((org.apache.maven.api.model.Relocation) newDelegate));
            return true;
        }
        return false;
    }

    public static List distributionManagementToApiV4(List list) {
        return list != null ? new WrapperList<>(list, DistributionManagement::getDelegate, DistributionManagement::new) : null;
    }

    public static List distributionManagementToApiV3(List list) {
        return list != null ? new WrapperList<>(list, DistributionManagement::new, DistributionManagement::getDelegate) : null;
    }

}