KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > idaremedia > antx > condition > AllSet


1 /**
2  * $Id: AllSet.java 180 2007-03-15 12:56:38Z ssmc $
3  * Copyright 2002-2004 iDare Media, Inc. All rights reserved.
4  *
5  * Originally written by iDare Media, Inc. for release into the public domain. This
6  * library, source form and binary form, is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2.1 of the License, or (at your option) any
9  * later version.<p>
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU LGPL (GNU Lesser General Public License) for more details.<p>
14  *
15  * You should have received a copy of the GNU Lesser General Public License along with this
16  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite
17  * 330, Boston, MA 02111-1307 USA. The LGPL can be found online at
18  * http://www.fsf.org/copyleft/lesser.html<p>
19  *
20  * This product has been influenced by several projects within the open-source community.
21  * The JWare developers wish to acknowledge the open-source community's support. For more
22  * information regarding the open-source products used within JWare, please visit the
23  * JWare website.
24  *----------------------------------------------------------------------------------------*
25  * WEBSITE- http://www.jware.info EMAIL- inquiries@jware.info
26  *----------------------------------------------------------------------------------------*
27  **/

28
29 package com.idaremedia.antx.condition;
30
31 import org.apache.tools.ant.Project;
32
33 import com.idaremedia.antx.AntX;
34
35 /**
36  * Shortcut condition that returns <i>true</i> if all of the nested items (properties,
37  * variables, references, etc.) are set in the project's environment. Can be
38  * setup to set a project property "<i>true</i>" on <i>true</i> evaluation.
39  * <p>
40  * <b>Example Usage:</b><pre>
41  * &lt;assert msgid="msg.stuff.missing"&gt;
42  * &lt;<b>allset</b> whitespace="ignore"&gt;
43  * &lt;property name="module.id/&gt;
44  * &lt;property name="module.basedir/&gt;
45  * &lt;reference name="module.classpath/&gt;
46  * &lt;/allset&gt;
47  * &lt;/assert&gt;
48  *
49  * &lt;fixturecheck msgid="msg.stuff.missing"&gt;
50  * &lt;<b>allset</b> malformed="reject"&gt;
51  * &lt;property name="module.id/&gt;
52  * &lt;properties prefix="mybuild." ignorecase="yes"/&gt;
53  * &lt;/allset&gt;
54  * &lt;/fixturecheck&gt;
55  * </pre>
56  *
57  * @since JWare/AntX 0.2
58  * @author ssmc, &copy;2002-2004 <a HREF="http://www.jware.info">iDare&nbsp;Media,&nbsp;Inc.</a>
59  * @version 0.5
60  * @.safety single
61  * @.group api,infra
62  * @see IsNotSet
63  * @see NoneSet
64  **/

65
66 public class AllSet extends CheckSetCondition implements URIable
67 {
68     /**
69      * Initializes new AllSet condition; defaults to returning <i>false</i>.
70      **/

71     public AllSet()
72     {
73         super(AntX.rules+"allset");
74     }
75
76
77     /**
78      * Initializes new CV-labeled AllSet condition; defaults to
79      * returning <i>false</i>.
80      * @param iam CV-label (non-null)
81      **/

82     public AllSet(String JavaDoc iam)
83     {
84         super(iam);
85     }
86
87
88     /**
89      * Initializes a CV-labeled filled in AllSet instance.
90      * @param properties comma-delimited list of properties
91      * @param P condition's project
92      **/

93     protected AllSet(String JavaDoc iam, String JavaDoc properties, final Project P)
94     {
95         super(iam);
96         setProject(P);
97         setProperties(properties);
98     }
99
100
101     /**
102      * Initializes a filled in AllSet instance.
103      * @param properties comma-delimited list of properties
104      * @param P condition's project
105      **/

106     public AllSet(String JavaDoc properties, final Project P)
107     {
108         this(AntX.rules+"allset",properties,P);
109     }
110
111
112
113     /**
114      * Sets this condition's list of properties as part of
115      * a value URI.
116      * @param fragment the value uri bits (non-null)
117      * @since JWare/AntX 0.5
118      */

119     public void xsetFromURI(String JavaDoc fragment)
120     {
121         xsetFromURIFragment(fragment);
122     }
123
124
125
126     /**
127      * Tells this set check to look for items with a positive
128      * boolean string as a value.
129      * @param allTrue <i>true</i> to force boolean check.
130      * @since JWare/AntX 0.5
131      **/

132     public final void setAllTrue(boolean allTrue)
133     {
134         if (allTrue) {
135             setTruesOnly();
136         }
137     }
138 }
139
140 /* end-of-AllSet.java */
141
Popular Tags