KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > types > selectors > BaseExtendSelector


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */

18 package org.apache.tools.ant.types.selectors;
19
20 import java.io.File JavaDoc;
21
22 import org.apache.tools.ant.BuildException;
23 import org.apache.tools.ant.types.Parameter;
24
25 /**
26  * Convenience base class for all selectors accessed through ExtendSelector.
27  * It provides support for gathering the parameters together as well as for
28  * assigning an error message and throwing a build exception if an error is
29  * detected.
30  *
31  * @since 1.5
32  */

33 public abstract class BaseExtendSelector
34         extends BaseSelector
35         implements ExtendFileSelector {
36
37     // CheckStyle:VisibilityModifier OFF - bc
38

39     /** The passed in parameter array. */
40     protected Parameter[] parameters = null;
41
42     // CheckStyle:VisibilityModifier ON
43

44     /**
45      * Default constructor.
46      */

47     public BaseExtendSelector() {
48     }
49
50     /**
51      * Set all the Parameters for this custom selector, collected by
52      * the ExtendSelector class.
53      *
54      * @param parameters the complete set of parameters for this selector
55      */

56     public void setParameters(Parameter[] parameters) {
57         this.parameters = parameters;
58     }
59
60     /**
61      * Allows access to the parameters gathered and set within the
62      * <custom> tag.
63      *
64      * @return the set of parameters defined for this selector
65      */

66     protected Parameter[] getParameters() {
67         return parameters;
68     }
69
70     /**
71      * Method that each selector will implement to create their
72      * selection behaviour. If there is a problem with the setup
73      * of a selector, it can throw a BuildException to indicate
74      * the problem.
75      *
76      * @param basedir A java.io.File object for the base directory
77      * @param filename The name of the file to check
78      * @param file A File object for this filename
79      * @return whether the file should be selected or not
80      * @exception BuildException if an error occurs
81      */

82     public abstract boolean isSelected(File JavaDoc basedir, String JavaDoc filename,
83                                        File JavaDoc file)
84             throws BuildException;
85
86 }
87
88
Popular Tags