01: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
02: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
03: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
04: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
05: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
06: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
07: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
08: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
09: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
12: // POSSIBILITY OF SUCH DAMAGE.
13: //
14: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
15: package com.metaboss.sdlctools.applications.anttasks;
16:
17: import java.io.File;
18:
19: import org.apache.tools.ant.BuildException;
20: import org.apache.tools.ant.types.Path;
21:
22: /**
23: * This class is a special ant data type class. It is used as a holder
24: * of the "name" and "value" attribute pair */
25: public class NameValuePairType {
26: private String mName = null;
27: private String mValue = null;
28:
29: /** The setter for the "name" attribute */
30: public void setName(String pName) throws BuildException {
31: mName = pName;
32: }
33:
34: /** The setter for the "value" attribute. Note that setValue(), setFile() and setPath()
35: * are mutually exclusive setters and only one of them can be called */
36: public void setValue(String pValue) throws BuildException {
37: if (mValue != null)
38: throw new BuildException(
39: "Only one of 'value', 'file' or 'path' arguments can be specified.");
40: mValue = pValue;
41: }
42:
43: /** The setter for the "file" attribute */
44: public void setFile(File pFile) throws BuildException {
45: if (mValue != null)
46: throw new BuildException(
47: "Only one of 'value', 'file' or 'path' arguments can be specified.");
48: mValue = pFile.getAbsolutePath();
49: }
50:
51: /** The setter for the "path" attribute */
52: public void setPath(Path pPath) throws BuildException {
53: if (mValue != null)
54: throw new BuildException(
55: "Only one of 'value', 'file' or 'path' arguments can be specified.");
56: mValue = pPath.toString();
57: }
58:
59: /** The getter for the "name" attribute */
60: public String getName() {
61: return mName;
62: }
63:
64: /** The getter for the "value" or "file" or "path" attribute */
65: public String getValue() {
66: return mValue;
67: }
68: }
|