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