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

org.apache.maven.model.MailingList 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.ArrayList;
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 MailingList
    extends BaseObject
{

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

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

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

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

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

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

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

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

    public void setName(String name) {
        if (!Objects.equals(name, getName())) {
            update(getDelegate().withName(name));
        }
    }

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

    public void setSubscribe(String subscribe) {
        if (!Objects.equals(subscribe, getSubscribe())) {
            update(getDelegate().withSubscribe(subscribe));
        }
    }

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

    public void setUnsubscribe(String unsubscribe) {
        if (!Objects.equals(unsubscribe, getUnsubscribe())) {
            update(getDelegate().withUnsubscribe(unsubscribe));
        }
    }

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

    public void setPost(String post) {
        if (!Objects.equals(post, getPost())) {
            update(getDelegate().withPost(post));
        }
    }

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

    public void setArchive(String archive) {
        if (!Objects.equals(archive, getArchive())) {
            update(getDelegate().withArchive(archive));
        }
    }

    @Nonnull
    public List getOtherArchives() {
        return new WrapperList(() -> getDelegate().getOtherArchives(), this::setOtherArchives, s -> s, s -> s);
    }

    public void setOtherArchives(List otherArchives) {
        if (!Objects.equals(otherArchives, getOtherArchives())) {
            update(getDelegate().withOtherArchives(otherArchives));
        }
    }

    public void addOtherArchive(String otherArchive) {
        update(getDelegate().withOtherArchives(
               Stream.concat(getDelegate().getOtherArchives().stream(), Stream.of(otherArchive))
                        .collect(Collectors.toList())));
    }

    public void removeOtherArchive(String otherArchive) {
        update(getDelegate().withOtherArchives(
               getDelegate().getOtherArchives().stream()
                        .filter(e -> !Objects.equals(e, otherArchive))
                        .collect(Collectors.toList())));
    }

    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.MailingList.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.MailingList.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;
        }
        return false;
    }

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

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


            
    /**
     * @see java.lang.Object#toString()
     */
    public String toString()
    {
        return "MailingList {name=" + getName() + ", archive=" + getArchive() + "}";
    }
            
          
}