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