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

org.apache.maven.model.PluginConfiguration 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 PluginConfiguration
    extends PluginContainer
    implements Serializable, Cloneable
{

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

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

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

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

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

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

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

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

    public void setPluginManagement(PluginManagement pluginManagement) {
        if (!Objects.equals(pluginManagement, getPluginManagement())){
            if (pluginManagement != null) {
                update(getDelegate().withPluginManagement(pluginManagement.getDelegate()));
                pluginManagement.childrenTracking = this::replace;
            } else {
                update(getDelegate().withPluginManagement(null));
            }
        }
    }

    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.PluginConfiguration.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.PluginConfiguration.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().getPluginManagement()) {
            update(getDelegate().withPluginManagement((org.apache.maven.api.model.PluginManagement) newDelegate));
            return true;
        }
        return false;
    }

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

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


            
    /**
     * @see java.lang.Object#toString()
     */
    public String toString()
    {
        return "PluginConfiguration {" + super.toString() + "}";
    }
            
          
}