
org.apache.maven.model.ReportPlugin Maven / Gradle / Ivy
// =================== 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.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 ReportPlugin
extends ConfigurationContainer
implements Serializable, Cloneable
{
public ReportPlugin() {
this(org.apache.maven.api.model.ReportPlugin.newInstance());
}
public ReportPlugin(org.apache.maven.api.model.ReportPlugin delegate) {
this(delegate, null);
}
public ReportPlugin(org.apache.maven.api.model.ReportPlugin delegate, BaseObject parent) {
super(delegate, parent);
}
public ReportPlugin clone(){
return new ReportPlugin(getDelegate());
}
@Override
public org.apache.maven.api.model.ReportPlugin getDelegate() {
return (org.apache.maven.api.model.ReportPlugin) super.getDelegate();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || !(o instanceof ReportPlugin)) {
return false;
}
ReportPlugin that = (ReportPlugin) 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));
}
}
@Nonnull
public List getReportSets() {
return new WrapperList(
() -> getDelegate().getReportSets(), l -> update(getDelegate().withReportSets(l)),
d -> new ReportSet(d, this), ReportSet::getDelegate);
}
public void setReportSets(List reportSets) {
if (reportSets == null) {
reportSets = Collections.emptyList();
}
if (!Objects.equals(reportSets, getReportSets())) {
update(getDelegate().withReportSets(
reportSets.stream().map(c -> c.getDelegate()).collect(Collectors.toList())));
reportSets.forEach(e -> e.childrenTracking = this::replace);
}
}
public void addReportSet(ReportSet reportSet) {
update(getDelegate().withReportSets(
Stream.concat(getDelegate().getReportSets().stream(), Stream.of(reportSet.getDelegate()))
.collect(Collectors.toList())));
reportSet.childrenTracking = this::replace;
}
public void removeReportSet(ReportSet reportSet) {
update(getDelegate().withReportSets(
getDelegate().getReportSets().stream()
.filter(e -> !Objects.equals(e, reportSet))
.collect(Collectors.toList())));
reportSet.childrenTracking = 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.ReportPlugin.newBuilder(getDelegate(), true)
.location(key, location.toApiLocation()).build());
}
protected boolean replace(Object oldDelegate, Object newDelegate) {
if (super.replace(oldDelegate, newDelegate)) {
return true;
}
if (getDelegate().getReportSets().contains(oldDelegate)) {
List list = new ArrayList<>(getDelegate().getReportSets());
list.replaceAll(d -> d == oldDelegate ? (org.apache.maven.api.model.ReportSet) newDelegate : d);
update(getDelegate().withReportSets(list));
return true;
}
return false;
}
public static List reportPluginToApiV4(List list) {
return list != null ? new WrapperList<>(list, ReportPlugin::getDelegate, ReportPlugin::new) : null;
}
public static List reportPluginToApiV3(List list) {
return list != null ? new WrapperList<>(list, ReportPlugin::new, ReportPlugin::getDelegate) : null;
}
private java.util.Map reportSetMap = null;
/**
* Reset the {@code reportSetMap} field to {@code null}
*/
public void flushReportSetMap()
{
this.reportSetMap = null;
}
/**
* @return a Map of reportSets field with {@code ReportSet#getId()} as key
* @see ReportSet#getId()
*/
public java.util.Map getReportSetsAsMap()
{
if ( reportSetMap == null )
{
reportSetMap = new java.util.LinkedHashMap();
if ( getReportSets() != null )
{
for ( java.util.Iterator i = getReportSets().iterator(); i.hasNext(); )
{
ReportSet reportSet = (ReportSet) i.next();
reportSetMap.put( reportSet.getId(), reportSet );
}
}
}
return reportSetMap;
}
/**
* @return the key of the report plugin, ie {@code groupId:artifactId}
*/
public String getKey()
{
return constructKey( getGroupId(), getArtifactId() );
}
/**
* @param groupId The group ID of the plugin in the repository
* @param artifactId The artifact ID of the reporting plugin in the repository
* @return the key of the report plugin, ie {@code groupId:artifactId}
*/
public static String constructKey( String groupId, String artifactId )
{
return groupId + ":" + artifactId;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy