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

org.apache.maven.settings.Server 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.settings;

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;
import org.codehaus.plexus.util.xml.Xpp3Dom;

@Generated
public class Server
    extends IdentifiableBase
    implements Serializable, Cloneable
{

    public Server() {
        this(org.apache.maven.api.settings.Server.newInstance());
    }

    public Server(org.apache.maven.api.settings.Server delegate) {
        this(delegate, null);
    }

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

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

    @Override
    public org.apache.maven.api.settings.Server getDelegate() {
        return (org.apache.maven.api.settings.Server) super.getDelegate();
    }

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

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

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

    public void setUsername(String username) {
        if (!Objects.equals(username, getUsername())) {
            update(getDelegate().withUsername(username));
        }
    }

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

    public void setPassword(String password) {
        if (!Objects.equals(password, getPassword())) {
            update(getDelegate().withPassword(password));
        }
    }

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

    public void setPrivateKey(String privateKey) {
        if (!Objects.equals(privateKey, getPrivateKey())) {
            update(getDelegate().withPrivateKey(privateKey));
        }
    }

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

    public void setPassphrase(String passphrase) {
        if (!Objects.equals(passphrase, getPassphrase())) {
            update(getDelegate().withPassphrase(passphrase));
        }
    }

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

    public void setFilePermissions(String filePermissions) {
        if (!Objects.equals(filePermissions, getFilePermissions())) {
            update(getDelegate().withFilePermissions(filePermissions));
        }
    }

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

    public void setDirectoryPermissions(String directoryPermissions) {
        if (!Objects.equals(directoryPermissions, getDirectoryPermissions())) {
            update(getDelegate().withDirectoryPermissions(directoryPermissions));
        }
    }

    public Object getConfiguration() {
        return getDelegate().getConfiguration() != null ? new Xpp3Dom(getDelegate().getConfiguration(), this::replace) : null;
    }

    public void setConfiguration(Object configuration) {
        if (configuration instanceof Xpp3Dom) {
            if (!Objects.equals(((Xpp3Dom) configuration).getDom(), getDelegate().getConfiguration())) {
                update(getDelegate().withConfiguration(((Xpp3Dom) configuration).getDom()));
                ((Xpp3Dom) configuration).setChildrenTracking(this::replace);
            }
        } else if (configuration == null) {
            if (getDelegate().getConfiguration() != null) {
                update(getDelegate().withConfiguration(null));
            }
        } else {
            throw new IllegalArgumentException("Expected an Xpp3Dom object but received a " + configuration.getClass() + ": " + configuration);
        }
    }

    protected boolean replace(Object oldDelegate, Object newDelegate) {
        if (super.replace(oldDelegate, newDelegate)) {
            return true;
        }
        if (getDelegate().getConfiguration() == oldDelegate) {
            update(getDelegate().withConfiguration((org.apache.maven.api.xml.XmlNode) newDelegate));
        }
        return false;
    }

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

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

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy