org.apache.maven.model.ModelBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-model Show documentation
Show all versions of maven-model Show documentation
Model for Maven POM (Project Object Model)
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.LinkedHashMap;
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;
import org.codehaus.plexus.util.xml.Xpp3Dom;
@Generated
public class ModelBase
extends BaseObject
{
public ModelBase() {
this(org.apache.maven.api.model.ModelBase.newInstance());
}
public ModelBase(org.apache.maven.api.model.ModelBase delegate) {
this(delegate, null);
}
public ModelBase(org.apache.maven.api.model.ModelBase delegate, BaseObject parent) {
super(delegate, parent);
}
public ModelBase clone(){
return new ModelBase(getDelegate());
}
public org.apache.maven.api.model.ModelBase getDelegate() {
return (org.apache.maven.api.model.ModelBase) super.getDelegate();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || !(o instanceof ModelBase)) {
return false;
}
ModelBase that = (ModelBase) o;
return Objects.equals(this.delegate, that.delegate);
}
@Override
public int hashCode() {
return getDelegate().hashCode();
}
@Nonnull
public List getModules() {
return new WrapperList(() -> getDelegate().getModules(), this::setModules, s -> s, s -> s);
}
public void setModules(List modules) {
if (!Objects.equals(modules, getModules())) {
update(getDelegate().withModules(modules));
}
}
public void addModule(String module) {
update(getDelegate().withModules(
Stream.concat(getDelegate().getModules().stream(), Stream.of(module))
.collect(Collectors.toList())));
}
public void removeModule(String module) {
update(getDelegate().withModules(
getDelegate().getModules().stream()
.filter(e -> !Objects.equals(e, module))
.collect(Collectors.toList())));
}
public DistributionManagement getDistributionManagement() {
return getDelegate().getDistributionManagement() != null ? new DistributionManagement(getDelegate().getDistributionManagement(), this) : null;
}
public void setDistributionManagement(DistributionManagement distributionManagement) {
if (!Objects.equals(distributionManagement, getDistributionManagement())){
if (distributionManagement != null) {
update(getDelegate().withDistributionManagement(distributionManagement.getDelegate()));
distributionManagement.childrenTracking = this::replace;
} else {
update(getDelegate().withDistributionManagement(null));
}
}
}
@Nonnull
public Properties getProperties() {
return new WrapperProperties(() -> getDelegate().getProperties(), this::setProperties);
}
public void setProperties(Properties properties) {
LinkedHashMap map = new LinkedHashMap<>();
properties.forEach((key, value) -> map.put(key.toString(), value.toString()));
if (!Objects.equals(map, getDelegate().getProperties())) {
update(getDelegate().withProperties(map));
}
}
public void addProperty(String key, String value) {
getProperties().put(key, value);
}
public DependencyManagement getDependencyManagement() {
return getDelegate().getDependencyManagement() != null ? new DependencyManagement(getDelegate().getDependencyManagement(), this) : null;
}
public void setDependencyManagement(DependencyManagement dependencyManagement) {
if (!Objects.equals(dependencyManagement, getDependencyManagement())){
if (dependencyManagement != null) {
update(getDelegate().withDependencyManagement(dependencyManagement.getDelegate()));
dependencyManagement.childrenTracking = this::replace;
} else {
update(getDelegate().withDependencyManagement(null));
}
}
}
@Nonnull
public List getDependencies() {
return new WrapperList(
() -> getDelegate().getDependencies(), l -> update(getDelegate().withDependencies(l)),
d -> new Dependency(d, this), Dependency::getDelegate);
}
public void setDependencies(List dependencies) {
if (dependencies == null) {
dependencies = Collections.emptyList();
}
if (!Objects.equals(dependencies, getDependencies())) {
update(getDelegate().withDependencies(
dependencies.stream().map(c -> c.getDelegate()).collect(Collectors.toList())));
dependencies.forEach(e -> e.childrenTracking = this::replace);
}
}
public void addDependency(Dependency dependency) {
update(getDelegate().withDependencies(
Stream.concat(getDelegate().getDependencies().stream(), Stream.of(dependency.getDelegate()))
.collect(Collectors.toList())));
dependency.childrenTracking = this::replace;
}
public void removeDependency(Dependency dependency) {
update(getDelegate().withDependencies(
getDelegate().getDependencies().stream()
.filter(e -> !Objects.equals(e, dependency))
.collect(Collectors.toList())));
dependency.childrenTracking = null;
}
@Nonnull
public List getRepositories() {
return new WrapperList(
() -> getDelegate().getRepositories(), l -> update(getDelegate().withRepositories(l)),
d -> new Repository(d, this), Repository::getDelegate);
}
public void setRepositories(List repositories) {
if (repositories == null) {
repositories = Collections.emptyList();
}
if (!Objects.equals(repositories, getRepositories())) {
update(getDelegate().withRepositories(
repositories.stream().map(c -> c.getDelegate()).collect(Collectors.toList())));
repositories.forEach(e -> e.childrenTracking = this::replace);
}
}
public void addRepository(Repository repository) {
update(getDelegate().withRepositories(
Stream.concat(getDelegate().getRepositories().stream(), Stream.of(repository.getDelegate()))
.collect(Collectors.toList())));
repository.childrenTracking = this::replace;
}
public void removeRepository(Repository repository) {
update(getDelegate().withRepositories(
getDelegate().getRepositories().stream()
.filter(e -> !Objects.equals(e, repository))
.collect(Collectors.toList())));
repository.childrenTracking = null;
}
@Nonnull
public List getPluginRepositories() {
return new WrapperList(
() -> getDelegate().getPluginRepositories(), l -> update(getDelegate().withPluginRepositories(l)),
d -> new Repository(d, this), Repository::getDelegate);
}
public void setPluginRepositories(List pluginRepositories) {
if (pluginRepositories == null) {
pluginRepositories = Collections.emptyList();
}
if (!Objects.equals(pluginRepositories, getPluginRepositories())) {
update(getDelegate().withPluginRepositories(
pluginRepositories.stream().map(c -> c.getDelegate()).collect(Collectors.toList())));
pluginRepositories.forEach(e -> e.childrenTracking = this::replace);
}
}
public void addPluginRepository(Repository pluginRepository) {
update(getDelegate().withPluginRepositories(
Stream.concat(getDelegate().getPluginRepositories().stream(), Stream.of(pluginRepository.getDelegate()))
.collect(Collectors.toList())));
pluginRepository.childrenTracking = this::replace;
}
public void removePluginRepository(Repository pluginRepository) {
update(getDelegate().withPluginRepositories(
getDelegate().getPluginRepositories().stream()
.filter(e -> !Objects.equals(e, pluginRepository))
.collect(Collectors.toList())));
pluginRepository.childrenTracking = null;
}
public Reporting getReporting() {
return getDelegate().getReporting() != null ? new Reporting(getDelegate().getReporting(), this) : null;
}
public void setReporting(Reporting reporting) {
if (!Objects.equals(reporting, getReporting())){
if (reporting != null) {
update(getDelegate().withReporting(reporting.getDelegate()));
reporting.childrenTracking = this::replace;
} else {
update(getDelegate().withReporting(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.ModelBase.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.ModelBase.newBuilder(getDelegate(), true)
.importedFrom(location != null ? location.toApiLocation() : null).build());
}
public Set © 2015 - 2025 Weber Informatics LLC | Privacy Policy