1 | /*
|
---|
2 | * Copyright 2002,2004 The Apache Software Foundation
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | */
|
---|
17 | package org.apache.tools.ant.filters;
|
---|
18 |
|
---|
19 | import java.io.Reader;
|
---|
20 | import org.apache.tools.ant.types.Parameter;
|
---|
21 | import org.apache.tools.ant.types.Parameterizable;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Parameterized base class for core filter readers.
|
---|
25 | *
|
---|
26 | */
|
---|
27 | public abstract class BaseParamFilterReader
|
---|
28 | extends BaseFilterReader
|
---|
29 | implements Parameterizable {
|
---|
30 | /** The passed in parameter array. */
|
---|
31 | private Parameter[] parameters;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Constructor for "dummy" instances.
|
---|
35 | *
|
---|
36 | * @see BaseFilterReader#BaseFilterReader()
|
---|
37 | */
|
---|
38 | public BaseParamFilterReader() {
|
---|
39 | super();
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Creates a new filtered reader.
|
---|
44 | *
|
---|
45 | * @param in A Reader object providing the underlying stream.
|
---|
46 | * Must not be <code>null</code>.
|
---|
47 | */
|
---|
48 | public BaseParamFilterReader(final Reader in) {
|
---|
49 | super(in);
|
---|
50 | }
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Sets the parameters used by this filter, and sets
|
---|
54 | * the filter to an uninitialized status.
|
---|
55 | *
|
---|
56 | * @param parameters The parameters to be used by this filter.
|
---|
57 | * Should not be <code>null</code>.
|
---|
58 | */
|
---|
59 | public final void setParameters(final Parameter[] parameters) {
|
---|
60 | this.parameters = parameters;
|
---|
61 | setInitialized(false);
|
---|
62 | }
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Returns the parameters to be used by this filter.
|
---|
66 | *
|
---|
67 | * @return the parameters to be used by this filter
|
---|
68 | */
|
---|
69 | protected final Parameter[] getParameters() {
|
---|
70 | return parameters;
|
---|
71 | }
|
---|
72 | }
|
---|