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.Set;
16  import java.util.stream.Collectors;
17  import java.util.stream.Stream;
18  import org.apache.maven.api.annotations.Generated;
19  import org.apache.maven.api.annotations.Nonnull;
20  
21  @Generated
22  public class PatternSet
23      extends BaseObject
24  {
25  
26      public PatternSet() {
27          this(org.apache.maven.api.model.PatternSet.newInstance());
28      }
29  
30      public PatternSet(org.apache.maven.api.model.PatternSet delegate) {
31          this(delegate, null);
32      }
33  
34      public PatternSet(org.apache.maven.api.model.PatternSet delegate, BaseObject parent) {
35          super(delegate, parent);
36      }
37  
38      public PatternSet clone(){
39          return new PatternSet(getDelegate());
40      }
41  
42      public org.apache.maven.api.model.PatternSet getDelegate() {
43          return (org.apache.maven.api.model.PatternSet) super.getDelegate();
44      }
45  
46      @Override
47      public boolean equals(Object o) {
48          if (this == o) {
49              return true;
50          }
51          if (o == null || !(o instanceof PatternSet)) {
52              return false;
53          }
54          PatternSet that = (PatternSet) o;
55          return Objects.equals(this.delegate, that.delegate);
56      }
57  
58      @Override
59      public int hashCode() {
60          return getDelegate().hashCode();
61      }
62  
63      @Nonnull
64      public List<String> getIncludes() {
65          return new WrapperList<String, String>(() -> getDelegate().getIncludes(), this::setIncludes, s -> s, s -> s);
66      }
67  
68      public void setIncludes(List<String> includes) {
69          if (!Objects.equals(includes, getIncludes())) {
70              update(getDelegate().withIncludes(includes));
71          }
72      }
73  
74      public void addInclude(String include) {
75          update(getDelegate().withIncludes(
76                 Stream.concat(getDelegate().getIncludes().stream(), Stream.of(include))
77                          .collect(Collectors.toList())));
78      }
79  
80      public void removeInclude(String include) {
81          update(getDelegate().withIncludes(
82                 getDelegate().getIncludes().stream()
83                          .filter(e -> !Objects.equals(e, include))
84                          .collect(Collectors.toList())));
85      }
86  
87      @Nonnull
88      public List<String> getExcludes() {
89          return new WrapperList<String, String>(() -> getDelegate().getExcludes(), this::setExcludes, s -> s, s -> s);
90      }
91  
92      public void setExcludes(List<String> excludes) {
93          if (!Objects.equals(excludes, getExcludes())) {
94              update(getDelegate().withExcludes(excludes));
95          }
96      }
97  
98      public void addExclude(String exclude) {
99          update(getDelegate().withExcludes(
100                Stream.concat(getDelegate().getExcludes().stream(), Stream.of(exclude))
101                         .collect(Collectors.toList())));
102     }
103 
104     public void removeExclude(String exclude) {
105         update(getDelegate().withExcludes(
106                getDelegate().getExcludes().stream()
107                         .filter(e -> !Objects.equals(e, exclude))
108                         .collect(Collectors.toList())));
109     }
110 
111     public InputLocation getLocation(Object key) {
112         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
113         return loc != null ? new InputLocation(loc) : null;
114     }
115 
116     public void setLocation(Object key, InputLocation location) {
117         update(org.apache.maven.api.model.PatternSet.newBuilder(getDelegate(), true)
118                         .location(key, location.toApiLocation()).build());
119     }
120 
121     public InputLocation getImportedFrom() {
122         org.apache.maven.api.model.InputLocation loc = getDelegate().getImportedFrom();
123         return loc != null ? new InputLocation(loc) : null;
124     }
125 
126     public void setImportedFrom(InputLocation location) {
127         update(org.apache.maven.api.model.PatternSet.newBuilder(getDelegate(), true)
128                         .importedFrom(location.toApiLocation()).build());
129     }
130 
131     public Set<Object> getLocationKeys() {
132         return getDelegate().getLocationKeys();
133     }
134 
135     protected boolean replace(Object oldDelegate, Object newDelegate) {
136         if (super.replace(oldDelegate, newDelegate)) {
137             return true;
138         }
139         return false;
140     }
141 
142     public static List<org.apache.maven.api.model.PatternSet> patternSetToApiV4(List<PatternSet> list) {
143         return list != null ? new WrapperList<>(list, PatternSet::getDelegate, PatternSet::new) : null;
144     }
145 
146     public static List<PatternSet> patternSetToApiV3(List<org.apache.maven.api.model.PatternSet> list) {
147         return list != null ? new WrapperList<>(list, PatternSet::new, PatternSet::getDelegate) : null;
148     }
149 
150 
151             
152     /**
153      * @see java.lang.Object#toString()
154      */
155     public String toString() {
156         return "PatternSet [" +
157             "includes: {" + getIncludes().stream().collect(java.util.stream.Collectors.joining(", ")) + "}, " +
158             "excludes: {" + getExcludes().stream().collect(java.util.stream.Collectors.joining(", ")) + "}]";
159     }
160             
161           
162 }