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.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 Notifier
22      extends BaseObject
23  {
24  
25      public Notifier() {
26          this(org.apache.maven.api.model.Notifier.newInstance());
27      }
28  
29      public Notifier(org.apache.maven.api.model.Notifier delegate) {
30          this(delegate, null);
31      }
32  
33      public Notifier(org.apache.maven.api.model.Notifier delegate, BaseObject parent) {
34          super(delegate, parent);
35      }
36  
37      public Notifier clone(){
38          return new Notifier(getDelegate());
39      }
40  
41      public org.apache.maven.api.model.Notifier getDelegate() {
42          return (org.apache.maven.api.model.Notifier) super.getDelegate();
43      }
44  
45      @Override
46      public boolean equals(Object o) {
47          if (this == o) {
48              return true;
49          }
50          if (o == null || !(o instanceof Notifier)) {
51              return false;
52          }
53          Notifier that = (Notifier) o;
54          return Objects.equals(this.delegate, that.delegate);
55      }
56  
57      @Override
58      public int hashCode() {
59          return getDelegate().hashCode();
60      }
61  
62      public String getType() {
63          return getDelegate().getType();
64      }
65  
66      public void setType(String type) {
67          if (!Objects.equals(type, getType())) {
68              update(getDelegate().withType(type));
69          }
70      }
71  
72      public boolean isSendOnError() {
73          return getDelegate().isSendOnError();
74      }
75  
76      public void setSendOnError(boolean sendOnError) {
77          if (!Objects.equals(sendOnError, isSendOnError())) {
78              update(getDelegate().withSendOnError(sendOnError));
79          }
80      }
81  
82      public boolean isSendOnFailure() {
83          return getDelegate().isSendOnFailure();
84      }
85  
86      public void setSendOnFailure(boolean sendOnFailure) {
87          if (!Objects.equals(sendOnFailure, isSendOnFailure())) {
88              update(getDelegate().withSendOnFailure(sendOnFailure));
89          }
90      }
91  
92      public boolean isSendOnSuccess() {
93          return getDelegate().isSendOnSuccess();
94      }
95  
96      public void setSendOnSuccess(boolean sendOnSuccess) {
97          if (!Objects.equals(sendOnSuccess, isSendOnSuccess())) {
98              update(getDelegate().withSendOnSuccess(sendOnSuccess));
99          }
100     }
101 
102     public boolean isSendOnWarning() {
103         return getDelegate().isSendOnWarning();
104     }
105 
106     public void setSendOnWarning(boolean sendOnWarning) {
107         if (!Objects.equals(sendOnWarning, isSendOnWarning())) {
108             update(getDelegate().withSendOnWarning(sendOnWarning));
109         }
110     }
111 
112     public String getAddress() {
113         return getDelegate().getAddress();
114     }
115 
116     public void setAddress(String address) {
117         if (!Objects.equals(address, getAddress())) {
118             update(getDelegate().withAddress(address));
119         }
120     }
121 
122     @Nonnull
123     public Properties getConfiguration() {
124         return new WrapperProperties(() -> getDelegate().getConfiguration(), this::setConfiguration);
125     }
126 
127     public void setConfiguration(Properties configuration) {
128         Map<String, String> map = configuration.entrySet().stream()
129                 .collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString()));
130         if (!Objects.equals(map, getDelegate().getConfiguration())) {
131             update(getDelegate().withConfiguration(map));
132         }
133     }
134 
135     public void addConfiguration(String key, String value) {
136         getConfiguration().put(key, value);
137     }
138 
139     public InputLocation getLocation(Object key) {
140         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
141         return loc != null ? new InputLocation(loc) : null;
142     }
143 
144     public void setLocation(Object key, InputLocation location) {
145         update(org.apache.maven.api.model.Notifier.newBuilder(getDelegate(), true)
146                         .location(key, location.toApiLocation()).build());
147     }
148 
149     protected boolean replace(Object oldDelegate, Object newDelegate) {
150         if (super.replace(oldDelegate, newDelegate)) {
151             return true;
152         }
153         return false;
154     }
155 
156     public static List<org.apache.maven.api.model.Notifier> notifierToApiV4(List<Notifier> list) {
157         return list != null ? new WrapperList<>(list, Notifier::getDelegate, Notifier::new) : null;
158     }
159 
160     public static List<Notifier> notifierToApiV3(List<org.apache.maven.api.model.Notifier> list) {
161         return list != null ? new WrapperList<>(list, Notifier::new, Notifier::getDelegate) : null;
162     }
163 
164 }