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

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

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

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

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

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

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

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

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

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

    public void setGroupId(String groupId) {
        if (!Objects.equals(groupId, getGroupId())) {
            update(getDelegate().withGroupId(groupId));
        }
    }

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

    public void setArtifactId(String artifactId) {
        if (!Objects.equals(artifactId, getArtifactId())) {
            update(getDelegate().withArtifactId(artifactId));
        }
    }

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

    public void setVersion(String version) {
        if (!Objects.equals(version, getVersion())) {
            update(getDelegate().withVersion(version));
        }
    }

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

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

}