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.stream.Collectors;
16  import java.util.stream.Stream;
17  import org.apache.maven.api.annotations.Generated;
18  import org.apache.maven.api.annotations.Nonnull;
19  
20  @Generated
21  public class Reporting
22      extends BaseObject
23  {
24  
25      public Reporting() {
26          this(org.apache.maven.api.model.Reporting.newInstance());
27      }
28  
29      public Reporting(org.apache.maven.api.model.Reporting delegate) {
30          this(delegate, null);
31      }
32  
33      public Reporting(org.apache.maven.api.model.Reporting delegate, BaseObject parent) {
34          super(delegate, parent);
35      }
36  
37      public Reporting clone(){
38          return new Reporting(getDelegate());
39      }
40  
41      public org.apache.maven.api.model.Reporting getDelegate() {
42          return (org.apache.maven.api.model.Reporting) super.getDelegate();
43      }
44  
45      @Override
46      public boolean equals(Object o) {
47          if (this == o) {
48              return true;
49          }
50          if (o == null || !(o instanceof Reporting)) {
51              return false;
52          }
53          Reporting that = (Reporting) o;
54          return Objects.equals(this.delegate, that.delegate);
55      }
56  
57      @Override
58      public int hashCode() {
59          return getDelegate().hashCode();
60      }
61  
62      public String getExcludeDefaults() {
63          return getDelegate().getExcludeDefaults();
64      }
65  
66      public void setExcludeDefaults(String excludeDefaults) {
67          if (!Objects.equals(excludeDefaults, getExcludeDefaults())) {
68              update(getDelegate().withExcludeDefaults(excludeDefaults));
69          }
70      }
71  
72      public String getOutputDirectory() {
73          return getDelegate().getOutputDirectory();
74      }
75  
76      public void setOutputDirectory(String outputDirectory) {
77          if (!Objects.equals(outputDirectory, getOutputDirectory())) {
78              update(getDelegate().withOutputDirectory(outputDirectory));
79          }
80      }
81  
82      @Nonnull
83      public List<ReportPlugin> getPlugins() {
84          return new WrapperList<ReportPlugin, org.apache.maven.api.model.ReportPlugin>(
85                      () -> getDelegate().getPlugins(), l -> update(getDelegate().withPlugins(l)),
86                      d -> new ReportPlugin(d, this), ReportPlugin::getDelegate);
87      }
88  
89      public void setPlugins(List<ReportPlugin> plugins) {
90          if (plugins == null) {
91              plugins = Collections.emptyList();
92          }
93          if (!Objects.equals(plugins, getPlugins())) {
94              update(getDelegate().withPlugins(
95                  plugins.stream().map(c -> c.getDelegate()).collect(Collectors.toList())));
96              plugins.forEach(e -> e.childrenTracking = this::replace);
97          }
98      }
99  
100     public void addPlugin(ReportPlugin plugin) {
101         update(getDelegate().withPlugins(
102                Stream.concat(getDelegate().getPlugins().stream(), Stream.of(plugin.getDelegate()))
103                         .collect(Collectors.toList())));
104         plugin.childrenTracking = this::replace;
105     }
106 
107     public void removePlugin(ReportPlugin plugin) {
108         update(getDelegate().withPlugins(
109                getDelegate().getPlugins().stream()
110                         .filter(e -> !Objects.equals(e, plugin))
111                         .collect(Collectors.toList())));
112         plugin.childrenTracking = null;
113     }
114 
115     public InputLocation getLocation(Object key) {
116         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
117         return loc != null ? new InputLocation(loc) : null;
118     }
119 
120     public void setLocation(Object key, InputLocation location) {
121         update(org.apache.maven.api.model.Reporting.newBuilder(getDelegate(), true)
122                         .location(key, location.toApiLocation()).build());
123     }
124 
125     protected boolean replace(Object oldDelegate, Object newDelegate) {
126         if (super.replace(oldDelegate, newDelegate)) {
127             return true;
128         }
129         if (getDelegate().getPlugins().contains(oldDelegate)) {
130             List<org.apache.maven.api.model.ReportPlugin> list = new ArrayList<>(getDelegate().getPlugins());
131             list.replaceAll(d -> d == oldDelegate ? (org.apache.maven.api.model.ReportPlugin) newDelegate : d);
132             update(getDelegate().withPlugins(list));
133             return true;
134         }
135         return false;
136     }
137 
138     public static List<org.apache.maven.api.model.Reporting> reportingToApiV4(List<Reporting> list) {
139         return list != null ? new WrapperList<>(list, Reporting::getDelegate, Reporting::new) : null;
140     }
141 
142     public static List<Reporting> reportingToApiV3(List<org.apache.maven.api.model.Reporting> list) {
143         return list != null ? new WrapperList<>(list, Reporting::new, Reporting::getDelegate) : null;
144     }
145 
146 
147             
148     public boolean isExcludeDefaults()
149     {
150         return ( getExcludeDefaults() != null ) ? Boolean.parseBoolean( getExcludeDefaults() ) : false;
151     }
152 
153             
154           
155 
156             
157     public void setExcludeDefaults( boolean excludeDefaults )
158     {
159         setExcludeDefaults( String.valueOf( excludeDefaults ) );
160     }
161 
162             
163           
164 }