01: /*
02: * Copyright 1999-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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.jk.ant;
18:
19: import org.apache.tools.ant.Project;
20:
21: /** Define name/value, value is optional
22: * The define will take place if the condition
23: * is met.
24: *
25: * A <so> task should include all the defines it supports,
26: * with the default value. This allows the builder to customize
27: * without having to look at the source.
28: */
29: public class Def {
30: String name;
31: String info;
32: String value;
33: String ifCond;
34: String unlessCond;
35: Project project;
36:
37: public Def() {
38: }
39:
40: public void setProject(Project p) {
41: project = p;
42: }
43:
44: public void setName(String n) {
45: name = n;
46: }
47:
48: public void setValue(String v) {
49: value = v;
50: }
51:
52: public void setIf(String ifCond) {
53: this .ifCond = ifCond;
54: }
55:
56: public void setUnless(String unlessCond) {
57: this .unlessCond = unlessCond;
58: }
59:
60: /** Informations about the option
61: */
62: public void setInfo(String n) {
63: info = n;
64: }
65:
66: // -------------------- Getters --------------------
67:
68: /** Return the name of the define, or null if the define is not
69: * valid ( if/unless conditions )
70: */
71: public String getName() {
72: if (ifCond != null && project.getProperty(ifCond) == null)
73: return null;
74: if (unlessCond != null
75: && project.getProperty(unlessCond) != null)
76: return null;
77: return name;
78: }
79:
80: public String getValue() {
81: return value;
82: }
83: }
|