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.Properties;
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 Contributor
22      extends BaseObject
23  {
24  
25      public Contributor()
26      {
27          this( org.apache.maven.api.model.Contributor.newInstance() );
28      }
29  
30      public Contributor( org.apache.maven.api.model.Contributor delegate )
31      {
32          this( delegate, null );
33      }
34  
35      public Contributor( org.apache.maven.api.model.Contributor delegate, BaseObject parent )
36      {
37          super( delegate, parent );
38      }
39  
40      public Contributor clone()
41      {
42          return new Contributor( getDelegate() );
43      }
44  
45      public org.apache.maven.api.model.Contributor getDelegate()
46      {
47          return ( org.apache.maven.api.model.Contributor ) super.getDelegate();
48      }
49  
50      public String getName()
51      {
52          return getDelegate().getName();
53      }
54  
55      public void setName( String name )
56      {
57          if ( !Objects.equals( name, getDelegate().getName() ) )
58          {
59              update( getDelegate().withName( name ) );
60          }
61      }
62  
63      public String getEmail()
64      {
65          return getDelegate().getEmail();
66      }
67  
68      public void setEmail( String email )
69      {
70          if ( !Objects.equals( email, getDelegate().getEmail() ) )
71          {
72              update( getDelegate().withEmail( email ) );
73          }
74      }
75  
76      public String getUrl()
77      {
78          return getDelegate().getUrl();
79      }
80  
81      public void setUrl( String url )
82      {
83          if ( !Objects.equals( url, getDelegate().getUrl() ) )
84          {
85              update( getDelegate().withUrl( url ) );
86          }
87      }
88  
89      public String getOrganization()
90      {
91          return getDelegate().getOrganization();
92      }
93  
94      public void setOrganization( String organization )
95      {
96          if ( !Objects.equals( organization, getDelegate().getOrganization() ) )
97          {
98              update( getDelegate().withOrganization( organization ) );
99          }
100     }
101 
102     public String getOrganizationUrl()
103     {
104         return getDelegate().getOrganizationUrl();
105     }
106 
107     public void setOrganizationUrl( String organizationUrl )
108     {
109         if ( !Objects.equals( organizationUrl, getDelegate().getOrganizationUrl() ) )
110         {
111             update( getDelegate().withOrganizationUrl( organizationUrl ) );
112         }
113     }
114 
115     @Nonnull
116     public List<String> getRoles()
117     {
118         return new WrapperList<String, String>( () -> getDelegate().getRoles(), this::setRoles, s -> s, s -> s );
119     }
120 
121     public void setRoles( List<String> roles )
122     {
123         if ( !Objects.equals( roles, getDelegate().getRoles() ) )
124         {
125             update( getDelegate().withRoles( roles ) );
126         }
127     }
128 
129     public void addRole( String role )
130     {
131         update( getDelegate().withRoles(
132                 Stream.concat( getDelegate().getRoles().stream(), Stream.of( role ) )
133                         .collect( Collectors.toList() ) ) );
134     }
135 
136     public void removeRole( String role )
137     {
138         update( getDelegate().withRoles(
139                 getDelegate().getRoles().stream()
140                         .filter( e -> !Objects.equals( e, role ) )
141                         .collect( Collectors.toList() ) ) );
142     }
143 
144     public String getTimezone()
145     {
146         return getDelegate().getTimezone();
147     }
148 
149     public void setTimezone( String timezone )
150     {
151         if ( !Objects.equals( timezone, getDelegate().getTimezone() ) )
152         {
153             update( getDelegate().withTimezone( timezone ) );
154         }
155     }
156 
157     @Nonnull
158     public Properties getProperties()
159     {
160         return new WrapperProperties( () -> getDelegate().getProperties(), this::setProperties );
161     }
162 
163     public void setProperties( Properties properties )
164     {
165         Map<String, String> map = properties.entrySet().stream()
166                 .collect( Collectors.toMap( e -> e.getKey().toString(), e -> e.getValue().toString() ) );
167         if ( !Objects.equals( map, getDelegate().getProperties() ) )
168         {
169             update( getDelegate().withProperties( map ) );
170         }
171     }
172 
173     public InputLocation getLocation( Object key )
174     {
175         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation( key );
176         return loc != null ? new InputLocation( loc ) : null;
177     }
178 
179     public void setLocation( Object key, InputLocation location )
180     {
181         update( org.apache.maven.api.model.Contributor.newBuilder( getDelegate(), true )
182                         .location( key, location.toApiLocation() ).build() );
183     }
184 
185     protected boolean replace( Object oldDelegate, Object newDelegate )
186     {
187         if ( super.replace( oldDelegate, newDelegate ) )
188         {
189             return true;
190         }
191         return false;
192     }
193 
194     public static List<org.apache.maven.api.model.Contributor> contributorToApiV4( List<Contributor> list )
195     {
196         return list != null ? new WrapperList<>( list, Contributor::getDelegate, Contributor::new ) : null;
197     }
198 
199     public static List<Contributor> contributorToApiV3( List<org.apache.maven.api.model.Contributor> list )
200     {
201         return list != null ? new WrapperList<>( list, Contributor::new, Contributor::getDelegate ) : null;
202     }
203 
204 }