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. import java.io.Reader;
  19. import org.apache.tools.ant.types.Parameter;
  20. import org.apache.tools.ant.types.Parameterizable;
  21. /**
  22. * Parameterized base class for core filter readers.
  23. *
  24. */
  25. public abstract class BaseParamFilterReader
  26. extends BaseFilterReader
  27. implements Parameterizable {
  28. /** The passed in parameter array. */
  29. private Parameter[] parameters;
  30. /**
  31. * Constructor for "dummy" instances.
  32. *
  33. * @see BaseFilterReader#BaseFilterReader()
  34. */
  35. public BaseParamFilterReader() {
  36. super();
  37. }
  38. /**
  39. * Creates a new filtered reader.
  40. *
  41. * @param in A Reader object providing the underlying stream.
  42. * Must not be <code>null</code>.
  43. */
  44. public BaseParamFilterReader(final Reader in) {
  45. super(in);
  46. }
  47. /**
  48. * Sets the parameters used by this filter, and sets
  49. * the filter to an uninitialized status.
  50. *
  51. * @param parameters The parameters to be used by this filter.
  52. * Should not be <code>null</code>.
  53. */
  54. public final void setParameters(final Parameter[] parameters) {
  55. this.parameters = parameters;
  56. setInitialized(false);
  57. }
  58. /**
  59. * Returns the parameters to be used by this filter.
  60. *
  61. * @return the parameters to be used by this filter
  62. */
  63. protected final Parameter[] getParameters() {
  64. return parameters;
  65. }
  66. }