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

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

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

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

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

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

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

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

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

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

    public void setInherited(String inherited) {
        if (!Objects.equals(inherited, getInherited())) {
            update(getDelegate().withInherited(inherited));
        }
    }

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

    public void setConfiguration(Object configuration) {
        if (configuration instanceof Xpp3Dom xpp3Dom) {
            if (!Objects.equals(xpp3Dom.getDom(), getDelegate().getConfiguration())) {
                update(getDelegate().withConfiguration(xpp3Dom.getDom()));
                xpp3Dom.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);
        }
    }

    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.ConfigurationContainer.newBuilder(getDelegate(), true)
                        .location(key, location != null ? location.toApiLocation() : null).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.ConfigurationContainer.newBuilder(getDelegate(), true)
                        .importedFrom(location != null ? location.toApiLocation() : null).build());
    }

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

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

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


            
    public boolean isInherited() {
        return ( getInherited() != null ) ? Boolean.parseBoolean( getInherited() ) : true;
    }

            
          

            
    @Deprecated
    public void unsetInheritanceApplied() {
    }

    @Deprecated
    public void setInherited(boolean value) {
      setInherited(Boolean.toString(value));
    }
            
          
}