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

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

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

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

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

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

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

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

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

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

    public void setType(String type) {
        if (!Objects.equals(type, getType())) {
            update(getDelegate().withType(type));
        }
    }

    public boolean isSendOnError() {
        return getDelegate().isSendOnError();
    }

    public void setSendOnError(boolean sendOnError) {
        if (!Objects.equals(sendOnError, isSendOnError())) {
            update(getDelegate().withSendOnError(sendOnError));
        }
    }

    public boolean isSendOnFailure() {
        return getDelegate().isSendOnFailure();
    }

    public void setSendOnFailure(boolean sendOnFailure) {
        if (!Objects.equals(sendOnFailure, isSendOnFailure())) {
            update(getDelegate().withSendOnFailure(sendOnFailure));
        }
    }

    public boolean isSendOnSuccess() {
        return getDelegate().isSendOnSuccess();
    }

    public void setSendOnSuccess(boolean sendOnSuccess) {
        if (!Objects.equals(sendOnSuccess, isSendOnSuccess())) {
            update(getDelegate().withSendOnSuccess(sendOnSuccess));
        }
    }

    public boolean isSendOnWarning() {
        return getDelegate().isSendOnWarning();
    }

    public void setSendOnWarning(boolean sendOnWarning) {
        if (!Objects.equals(sendOnWarning, isSendOnWarning())) {
            update(getDelegate().withSendOnWarning(sendOnWarning));
        }
    }

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

    public void setAddress(String address) {
        if (!Objects.equals(address, getAddress())) {
            update(getDelegate().withAddress(address));
        }
    }

    @Nonnull
    public Properties getConfiguration() {
        return new WrapperProperties(() -> getDelegate().getConfiguration(), this::setConfiguration);
    }

    public void setConfiguration(Properties configuration) {
        Map map = configuration.entrySet().stream()
                .collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString()));
        if (!Objects.equals(map, getDelegate().getConfiguration())) {
            update(getDelegate().withConfiguration(map));
        }
    }

    public void addConfiguration(String key, String value) {
        getConfiguration().put(key, value);
    }

    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.Notifier.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.Notifier.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 notifierToApiV4(List list) {
        return list != null ? new WrapperList<>(list, Notifier::getDelegate, Notifier::new) : null;
    }

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

}