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