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