KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jk > ant > JkData


1 /*
2  * Copyright 1999-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.jk.ant;
18
19 import org.apache.tools.ant.Project;
20
21 /**
22  * Set platform specific data. Can be used to specify files (fileName="value")
23  * symbols (symbol="value") or generic values (value="value"). A platform
24  * can also be set on the object so that platform specific compilers can
25  * determine if they want to use the values.
26  * XXX will use apxs query to detect the flags.
27  *
28  * @author Mike Anderson
29  */

30 public class JkData {
31
32     private String JavaDoc value;
33     private boolean isfile = false;
34     private String JavaDoc ifCond;
35     String JavaDoc unlessCond;
36     Project project;
37     
38     
39     public JkData() {
40     }
41
42     public void setProject( Project p ) {
43         project=p;
44     }
45     
46     public void setFileName( String JavaDoc s ) {
47         value = s;
48         isfile = true;
49     }
50     
51     public void setSymbol( String JavaDoc s ) {
52         value = s;
53         isfile = false;
54     }
55
56     public void setValue( String JavaDoc s ) {
57         value = s;
58     }
59
60     public void setIsFile( boolean isf ) {
61         isfile = isf;
62     }
63
64     public void setIf( String JavaDoc s ) {
65         ifCond = s;
66     }
67
68     public void setUnless( String JavaDoc s ) {
69         unlessCond = s;
70     }
71
72     public String JavaDoc getValue()
73     {
74         if( ifCond!=null && project.getProperty(ifCond) == null )
75             return null;
76         if (unlessCond != null && project.getProperty(unlessCond) != null)
77             return null;
78         return value;
79     }
80
81     public boolean isFile()
82     {
83         return isfile;
84     }
85 }
86
Popular Tags