View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   //  Generated by Modello Velocity from model-v3.vm
3   //  template, any modifications will be overwritten.
4   // ==============================================================
5   package org.apache.maven.model;
6   
7   import java.io.Serializable;
8   import java.util.AbstractList;
9   import java.util.ArrayList;
10  import java.util.Collections;
11  import java.util.HashMap;
12  import java.util.List;
13  import java.util.Map;
14  import java.util.Objects;
15  import java.util.Set;
16  import java.util.stream.Collectors;
17  import java.util.stream.Stream;
18  import org.apache.maven.api.annotations.Generated;
19  import org.apache.maven.api.annotations.Nonnull;
20  
21  @Generated
22  public class Reporting
23      extends BaseObject
24  {
25  
26      public Reporting() {
27          this(org.apache.maven.api.model.Reporting.newInstance());
28      }
29  
30      public Reporting(org.apache.maven.api.model.Reporting delegate) {
31          this(delegate, null);
32      }
33  
34      public Reporting(org.apache.maven.api.model.Reporting delegate, BaseObject parent) {
35          super(delegate, parent);
36      }
37  
38      public Reporting clone(){
39          return new Reporting(getDelegate());
40      }
41  
42      public org.apache.maven.api.model.Reporting getDelegate() {
43          return (org.apache.maven.api.model.Reporting) super.getDelegate();
44      }
45  
46      @Override
47      public boolean equals(Object o) {
48          if (this == o) {
49              return true;
50          }
51          if (o == null || !(o instanceof Reporting)) {
52              return false;
53          }
54          Reporting that = (Reporting) o;
55          return Objects.equals(this.delegate, that.delegate);
56      }
57  
58      @Override
59      public int hashCode() {
60          return getDelegate().hashCode();
61      }
62  
63      public String getExcludeDefaults() {
64          return getDelegate().getExcludeDefaults();
65      }
66  
67      public void setExcludeDefaults(String excludeDefaults) {
68          if (!Objects.equals(excludeDefaults, getExcludeDefaults())) {
69              update(getDelegate().withExcludeDefaults(excludeDefaults));
70          }
71      }
72  
73      public String getOutputDirectory() {
74          return getDelegate().getOutputDirectory();
75      }
76  
77      public void setOutputDirectory(String outputDirectory) {
78          if (!Objects.equals(outputDirectory, getOutputDirectory())) {
79              update(getDelegate().withOutputDirectory(outputDirectory));
80          }
81      }
82  
83      @Nonnull
84      public List<ReportPlugin> getPlugins() {
85          return new WrapperList<ReportPlugin, org.apache.maven.api.model.ReportPlugin>(
86                      () -> getDelegate().getPlugins(), l -> update(getDelegate().withPlugins(l)),
87                      d -> new ReportPlugin(d, this), ReportPlugin::getDelegate);
88      }
89  
90      public void setPlugins(List<ReportPlugin> plugins) {
91          if (plugins == null) {
92              plugins = Collections.emptyList();
93          }
94          if (!Objects.equals(plugins, getPlugins())) {
95              update(getDelegate().withPlugins(
96                  plugins.stream().map(c -> c.getDelegate()).collect(Collectors.toList())));
97              plugins.forEach(e -> e.childrenTracking = this::replace);
98          }
99      }
100 
101     public void addPlugin(ReportPlugin plugin) {
102         update(getDelegate().withPlugins(
103                Stream.concat(getDelegate().getPlugins().stream(), Stream.of(plugin.getDelegate()))
104                         .collect(Collectors.toList())));
105         plugin.childrenTracking = this::replace;
106     }
107 
108     public void removePlugin(ReportPlugin plugin) {
109         update(getDelegate().withPlugins(
110                getDelegate().getPlugins().stream()
111                         .filter(e -> !Objects.equals(e, plugin))
112                         .collect(Collectors.toList())));
113         plugin.childrenTracking = null;
114     }
115 
116     public InputLocation getLocation(Object key) {
117         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
118         return loc != null ? new InputLocation(loc) : null;
119     }
120 
121     public void setLocation(Object key, InputLocation location) {
122         update(org.apache.maven.api.model.Reporting.newBuilder(getDelegate(), true)
123                         .location(key, location.toApiLocation()).build());
124     }
125 
126     public InputLocation getImportedFrom() {
127         org.apache.maven.api.model.InputLocation loc = getDelegate().getImportedFrom();
128         return loc != null ? new InputLocation(loc) : null;
129     }
130 
131     public void setImportedFrom(InputLocation location) {
132         update(org.apache.maven.api.model.Reporting.newBuilder(getDelegate(), true)
133                         .importedFrom(location.toApiLocation()).build());
134     }
135 
136     public Set<Object> getLocationKeys() {
137         return getDelegate().getLocationKeys();
138     }
139 
140     protected boolean replace(Object oldDelegate, Object newDelegate) {
141         if (super.replace(oldDelegate, newDelegate)) {
142             return true;
143         }
144         if (getDelegate().getPlugins().contains(oldDelegate)) {
145             List<org.apache.maven.api.model.ReportPlugin> list = new ArrayList<>(getDelegate().getPlugins());
146             list.replaceAll(d -> d == oldDelegate ? (org.apache.maven.api.model.ReportPlugin) newDelegate : d);
147             update(getDelegate().withPlugins(list));
148             return true;
149         }
150         return false;
151     }
152 
153     public static List<org.apache.maven.api.model.Reporting> reportingToApiV4(List<Reporting> list) {
154         return list != null ? new WrapperList<>(list, Reporting::getDelegate, Reporting::new) : null;
155     }
156 
157     public static List<Reporting> reportingToApiV3(List<org.apache.maven.api.model.Reporting> list) {
158         return list != null ? new WrapperList<>(list, Reporting::new, Reporting::getDelegate) : null;
159     }
160 
161 
162             
163     public boolean isExcludeDefaults() {
164         return (getExcludeDefaults() != null) ? Boolean.parseBoolean(getExcludeDefaults()) : false;
165     }
166 
167             
168           
169 
170             
171     public void setExcludeDefaults(boolean excludeDefaults) {
172         setExcludeDefaults(String.valueOf(excludeDefaults));
173     }
174 
175     /**
176      * Reset the <code>reportPluginMap</code> field to <code>null</code>
177      */
178     @Deprecated
179     public void flushReportPluginMap() {
180     }
181 
182     /**
183      * @return a Map of plugins field with <code>ReportPlugin#getKey()</code> as key
184      * @see org.apache.maven.model.ReportPlugin#getKey()
185      */
186     public java.util.Map<String, ReportPlugin> getReportPluginsAsMap() {
187         return getPlugins().stream().collect(Collectors.toMap(report -> report.getKey(), report -> report));
188     }
189             
190           
191 }