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