1
2
3
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 import org.codehaus.plexus.util.xml.Xpp3Dom;
20
21 @Generated
22 public class ReportSet
23 extends ConfigurationContainer
24 implements Serializable, Cloneable
25 {
26
27 public ReportSet()
28 {
29 this( org.apache.maven.api.model.ReportSet.newInstance() );
30 }
31
32 public ReportSet( org.apache.maven.api.model.ReportSet delegate )
33 {
34 this( delegate, null );
35 }
36
37 public ReportSet( org.apache.maven.api.model.ReportSet delegate, BaseObject parent )
38 {
39 super( delegate, parent );
40 }
41
42 public ReportSet clone()
43 {
44 return new ReportSet( getDelegate() );
45 }
46
47 @Override
48 public org.apache.maven.api.model.ReportSet getDelegate()
49 {
50 return ( org.apache.maven.api.model.ReportSet ) super.getDelegate();
51 }
52
53 @Override
54 public boolean equals( Object o )
55 {
56 if ( this == o )
57 {
58 return true;
59 }
60 if ( o == null || !( o instanceof ReportSet ) )
61 {
62 return false;
63 }
64 ReportSet that = ( ReportSet ) o;
65 return Objects.equals( this.delegate, that.delegate );
66 }
67
68 @Override
69 public int hashCode()
70 {
71 return getDelegate().hashCode();
72 }
73
74 public String getId()
75 {
76 return getDelegate().getId();
77 }
78
79 public void setId( String id )
80 {
81 if ( !Objects.equals( id, getDelegate().getId() ) )
82 {
83 update( getDelegate().withId( id ) );
84 }
85 }
86
87 @Nonnull
88 public List<String> getReports()
89 {
90 return new WrapperList<String, String>( () -> getDelegate().getReports(), this::setReports, s -> s, s -> s );
91 }
92
93 public void setReports( List<String> reports )
94 {
95 if ( !Objects.equals( reports, getDelegate().getReports() ) )
96 {
97 update( getDelegate().withReports( reports ) );
98 }
99 }
100
101 public void addReport( String report )
102 {
103 update( getDelegate().withReports(
104 Stream.concat( getDelegate().getReports().stream(), Stream.of( report ) )
105 .collect( Collectors.toList() ) ) );
106 }
107
108 public void removeReport( String report )
109 {
110 update( getDelegate().withReports(
111 getDelegate().getReports().stream()
112 .filter( e -> !Objects.equals( e, report ) )
113 .collect( Collectors.toList() ) ) );
114 }
115
116 public InputLocation getLocation( Object key )
117 {
118 org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation( key );
119 return loc != null ? new InputLocation( loc ) : null;
120 }
121
122 public void setLocation( Object key, InputLocation location )
123 {
124 update( org.apache.maven.api.model.ReportSet.newBuilder( getDelegate(), true )
125 .location( key, location.toApiLocation() ).build() );
126 }
127
128 protected boolean replace( Object oldDelegate, Object newDelegate )
129 {
130 if ( super.replace( oldDelegate, newDelegate ) )
131 {
132 return true;
133 }
134 return false;
135 }
136
137 public static List<org.apache.maven.api.model.ReportSet> reportSetToApiV4( List<ReportSet> list )
138 {
139 return list != null ? new WrapperList<>( list, ReportSet::getDelegate, ReportSet::new ) : null;
140 }
141
142 public static List<ReportSet> reportSetToApiV3( List<org.apache.maven.api.model.ReportSet> list )
143 {
144 return list != null ? new WrapperList<>( list, ReportSet::new, ReportSet::getDelegate ) : null;
145 }
146
147
148
149 @Override
150 public String toString()
151 {
152 return getId();
153 }
154
155
156 }