01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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:
19: package org.apache.tools.ant.util.facade;
20:
21: import org.apache.tools.ant.types.Commandline;
22:
23: /**
24: * Extension of Commandline.Argument with a new attribute that choses
25: * a specific implementation of the facade.
26: *
27: *
28: * @since Ant 1.5
29: */
30: public class ImplementationSpecificArgument extends
31: Commandline.Argument {
32: private String impl;
33:
34: /** Constructor for ImplementationSpecificArgument. */
35: public ImplementationSpecificArgument() {
36: super ();
37: }
38:
39: /**
40: * Set the implementation this argument is for.
41: * @param impl the implementation this command line argument is for.
42: */
43: public void setImplementation(String impl) {
44: this .impl = impl;
45: }
46:
47: /**
48: * Return the parts this Argument consists of, if the
49: * implementation matches the chosen implementation.
50: * @see org.apache.tools.ant.types.Commandline.Argument#getParts()
51: * @param chosenImpl the implementation to check against.
52: * @return the parts if the implemention matches or an zero length
53: * array if not.
54: */
55: public final String[] getParts(String chosenImpl) {
56: if (impl == null || impl.equals(chosenImpl)) {
57: return super .getParts();
58: } else {
59: return new String[0];
60: }
61: }
62: }
|