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.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 Resource
23 extends FileSet
24 implements Serializable, Cloneable
25 {
26
27 public Resource() {
28 this(org.apache.maven.api.model.Resource.newInstance());
29 }
30
31 public Resource(org.apache.maven.api.model.Resource delegate) {
32 this(delegate, null);
33 }
34
35 public Resource(org.apache.maven.api.model.Resource delegate, BaseObject parent) {
36 super(delegate, parent);
37 }
38
39 public Resource clone(){
40 return new Resource(getDelegate());
41 }
42
43 @Override
44 public org.apache.maven.api.model.Resource getDelegate() {
45 return (org.apache.maven.api.model.Resource) super.getDelegate();
46 }
47
48 @Override
49 public boolean equals(Object o) {
50 if (this == o) {
51 return true;
52 }
53 if (o == null || !(o instanceof Resource)) {
54 return false;
55 }
56 Resource that = (Resource) o;
57 return Objects.equals(this.delegate, that.delegate);
58 }
59
60 @Override
61 public int hashCode() {
62 return getDelegate().hashCode();
63 }
64
65 public String getTargetPath() {
66 return getDelegate().getTargetPath();
67 }
68
69 public void setTargetPath(String targetPath) {
70 if (!Objects.equals(targetPath, getTargetPath())) {
71 update(getDelegate().withTargetPath(targetPath));
72 }
73 }
74
75 public String getFiltering() {
76 return getDelegate().getFiltering();
77 }
78
79 public void setFiltering(String filtering) {
80 if (!Objects.equals(filtering, getFiltering())) {
81 update(getDelegate().withFiltering(filtering));
82 }
83 }
84
85 public String getMergeId() {
86 return getDelegate().getMergeId();
87 }
88
89 public void setMergeId(String mergeId) {
90 if (!Objects.equals(mergeId, getMergeId())) {
91 update(getDelegate().withMergeId(mergeId));
92 }
93 }
94
95 public InputLocation getLocation(Object key) {
96 org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
97 return loc != null ? new InputLocation(loc) : null;
98 }
99
100 public void setLocation(Object key, InputLocation location) {
101 update(org.apache.maven.api.model.Resource.newBuilder(getDelegate(), true)
102 .location(key, location.toApiLocation()).build());
103 }
104
105 public InputLocation getImportedFrom() {
106 org.apache.maven.api.model.InputLocation loc = getDelegate().getImportedFrom();
107 return loc != null ? new InputLocation(loc) : null;
108 }
109
110 public void setImportedFrom(InputLocation location) {
111 update(org.apache.maven.api.model.Resource.newBuilder(getDelegate(), true)
112 .importedFrom(location.toApiLocation()).build());
113 }
114
115 public Set<Object> getLocationKeys() {
116 return getDelegate().getLocationKeys();
117 }
118
119 protected boolean replace(Object oldDelegate, Object newDelegate) {
120 if (super.replace(oldDelegate, newDelegate)) {
121 return true;
122 }
123 return false;
124 }
125
126 public static List<org.apache.maven.api.model.Resource> resourceToApiV4(List<Resource> list) {
127 return list != null ? new WrapperList<>(list, Resource::getDelegate, Resource::new) : null;
128 }
129
130 public static List<Resource> resourceToApiV3(List<org.apache.maven.api.model.Resource> list) {
131 return list != null ? new WrapperList<>(list, Resource::new, Resource::getDelegate) : null;
132 }
133
134
135
136 public boolean isFiltering() {
137 return (getFiltering() != null) ? Boolean.parseBoolean(getFiltering()) : false;
138 }
139
140
141
142
143 public void setFiltering(boolean filtering) {
144 setFiltering(String.valueOf(filtering));
145 }
146
147
148
149
150
151
152
153 public String toString() {
154 return "Resource {targetPath: " + getTargetPath() + ", filtering: " + isFiltering() + ", " + super.toString() + "}";
155 }
156
157
158 }