1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.plugin.eclipse;
20
21 import org.apache.maven.plugin.ide.IdeUtils;
22
23 /**
24 * Represent an eclipse source dir. Eclipse has no "main", "test" or "resource" concepts, so two source dirs with the
25 * same path are equal.
26 *
27 * @author <a href="mailto:fgiust@users.sourceforge.net">Fabrizio Giustina</a>
28 * @version $Id: EclipseSourceDir.java 728546 2008-12-21 22:56:51Z bentmann $
29 */
30 public class EclipseSourceDir
31 implements Comparable
32 {
33 private String path;
34
35 private String output;
36
37 private String include;
38
39 private String exclude;
40
41 private boolean isResource;
42
43 private boolean test;
44
45 private boolean filtering;
46
47 public EclipseSourceDir( String path, String output, boolean isResource, boolean test, String include,
48 String exclude, boolean filtering )
49 {
50 setPath( path );
51 this.output = output;
52 this.isResource = isResource;
53 this.test = test;
54 this.include = include;
55 this.exclude = exclude;
56 this.filtering = filtering;
57 }
58
59 /**
60 * Getter for <code>exclude</code>.
61 *
62 * @return Returns the exclude.
63 */
64 public String getExclude()
65 {
66 return this.exclude;
67 }
68
69 /**
70 * Setter for <code>exclude</code>.
71 *
72 * @param exclude The exclude to set.
73 */
74 public void setExclude( String exclude )
75 {
76 this.exclude = exclude;
77 }
78
79 /**
80 * Getter for <code>include</code>.
81 *
82 * @return Returns the include.
83 */
84 public String getInclude()
85 {
86 return this.include;
87 }
88
89 /**
90 * Setter for <code>include</code>.
91 *
92 * @param include The include to set.
93 */
94 public void setInclude( String include )
95 {
96 this.include = include;
97 }
98
99 /**
100 * Getter for <code>output</code>.
101 *
102 * @return Returns the output.
103 */
104 public String getOutput()
105 {
106 return this.output;
107 }
108
109 /**
110 * Setter for <code>output</code>.
111 *
112 * @param output The output to set.
113 */
114 public void setOutput( String output )
115 {
116 this.output = output;
117 }
118
119 /**
120 * Getter for <code>path</code>.
121 *
122 * @return Returns the path.
123 */
124 public String getPath()
125 {
126 return this.path;
127 }
128
129 /**
130 * Setter for <code>path</code>.
131 * Converts \\ to / in path.
132 *
133 * @param path The path to set.
134 */
135 public void setPath( String path )
136 {
137 this.path = IdeUtils.fixSeparator( path );
138 }
139
140 /**
141 * Getter for <code>test</code>.
142 *
143 * @return Returns the test.
144 */
145 public boolean isTest()
146 {
147 return this.test;
148 }
149
150 /**
151 * Setter for <code>test</code>.
152 *
153 * @param test The test to set.
154 */
155 public void setTest( boolean test )
156 {
157 this.test = test;
158 }
159
160 /**
161 * Getter for <code>isResource</code>.
162 *
163 * @return Returns the isResource.
164 */
165 public boolean isResource()
166 {
167 return this.isResource;
168 }
169
170 /**
171 * Wheter this resource should be copied with filtering.
172 */
173 public boolean isFiltering()
174 {
175 return filtering;
176 }
177
178 /**
179 * @see java.lang.Object#equals(java.lang.Object)
180 */
181 public boolean equals( Object obj )
182 {
183 return ( obj != null ) && ( obj instanceof EclipseSourceDir )
184 && this.path.equals( ( (EclipseSourceDir) obj ).path );
185 }
186
187 /**
188 * @see java.lang.Object#hashCode()
189 */
190 public int hashCode()
191 {
192 return this.path.hashCode();
193 }
194
195 /**
196 * @see java.lang.Comparable#compareTo(java.lang.Object)
197 */
198 public int compareTo( Object obj )
199 {
200 return this.path.compareTo( ( (EclipseSourceDir) obj ).path );
201 }
202 }