KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejen > ext > Version


1 //
2
// Ejen (code generation system)
3
// Copyright (C) 2001, 2002 François Wolff (ejen@noos.fr).
4
//
5
// This file is part of Ejen.
6
//
7
// Ejen is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
11
//
12
// Ejen is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
16
//
17
// You should have received a copy of the GNU General Public License
18
// along with Ejen; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
//
21
package org.ejen.ext;
22
23 import org.apache.xalan.extensions.ExpressionContext;
24
25 /**
26  * Ejen version utility (static methods).
27  * <p>
28  * <table class="usage">
29  * <tr><th class="usage">Usage (XSL stylesheet)</th></tr>
30  * <tr><td class="usage"><pre>
31  *
32  * &lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
33  *
34  * &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
35  * ...
36  * <b>xmlns:ver="org.ejen.ext.Version"</b>
37  * version="1.0"&gt;
38  *
39  * &lt;xsl:output method="xml" encoding="iso-8859-1"/&gt;
40  *
41  * &lt;xsl:template match="ejen"&gt;
42  *
43  * &lt;ejen-version&gt;
44  * &lt;xsl:value-of select="ver:{@link #toString(ExpressionContext) toString}()"/&gt;
45  * &lt;/ejen-version&gt;
46  * &lt;ejen-high-version&gt;
47  * &lt;xsl:value-of select="ver:{@link #high(ExpressionContext) high}()"/&gt;
48  * &lt;/ejen-high-version&gt;
49  * &lt;ejen-low-version&gt;
50  * &lt;xsl:value-of select="ver:{@link #low(ExpressionContext) low}()"/&gt;
51  * &lt;/ejen-low-version&gt;
52  * &lt;ejen-version-status&gt;
53  * &lt;xsl:value-of select="ver:{@link #status(ExpressionContext) status}()"/&gt;
54  * &lt;/ejen-version-status&gt;
55  *
56  * &lt;/xsl:template&gt;
57  *
58  * &lt;/xsl:stylesheet&gt;
59  * </pre></td></tr></table>
60  * @author F. Wolff
61  * @version 1.0
62  */

63 public class Version {
64
65     /**
66      * Protected constructor (prevents instanciation).
67      */

68     protected Version() {}
69
70     /** High version number: "1". */
71     public static final int HIGH_VERSION = 1;
72
73     /** Low version number: "0". */
74     public static final int LOW_VERSION = 0;
75
76     /** Version status: ".0". */
77     public static final String JavaDoc VERSION_STATUS = ".0";
78
79     /**
80      * Returns the Ejen high version number.
81      * <p>
82      * <table class="usage"><tr><td class="usage"><pre>
83      *
84      * &lt;xsl:variable name="high-version" select="ver:high()"/&gt;
85      * </pre></td></tr></table>
86      * <p>
87      * @param context automatically passed by the xalan extension mechanism.
88      * @return the high version number.
89      */

90     public static int high(ExpressionContext context) {
91         return HIGH_VERSION;
92     }
93
94     /**
95      * Returns the Ejen low version number.
96      * <p>
97      * <table class="usage"><tr><td class="usage"><pre>
98      *
99      * &lt;xsl:variable name="low-version" select="ver:low()"/&gt;
100      * </pre></td></tr></table>
101      * <p>
102      * @param context automatically passed by the xalan extension mechanism.
103      * @return the low version number.
104      */

105     public static int low(ExpressionContext context) {
106         return LOW_VERSION;
107     }
108
109     /**
110      * Returns the Ejen low version number.
111      * <p>
112      * <table class="usage"><tr><td class="usage"><pre>
113      *
114      * &lt;xsl:variable name="version-status" select="ver:status()"/&gt;
115      * </pre></td></tr></table>
116      * <p>
117      * @param context automatically passed by the xalan extension mechanism.
118      * @return the version status String.
119      */

120     public static String JavaDoc status(ExpressionContext context) {
121         return VERSION_STATUS;
122     }
123
124     /**
125      * Returns the Ejen high version number.
126      * <p>
127      * <table class="usage"><tr><td class="usage"><pre>
128      *
129      * &lt;xsl:variable name="version" select="ver:version()"/&gt;
130      * </pre></td></tr></table>
131      * <p>
132      * @param context automatically passed by the xalan extension mechanism.
133      * @return the version number in the form of
134      * "&lt;HIGH_VERSION&gt;.&lt;LOW_VERSION&gt;&lt;VERSION_STATUS&gt;".
135      */

136     public static String JavaDoc toString(ExpressionContext context) {
137         return "" + HIGH_VERSION + "." + LOW_VERSION + VERSION_STATUS;
138     }
139 }
140
Popular Tags