KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > tools > xjc > runtime > MetaVariable


1 package com.sun.tools.xjc.runtime;
2
3 /**
4  *
5  * <p>
6  * Depending on the compiler settings, we want to generate
7  * slightly different code. Doing this requires the
8  * code-generation control that goes finer than the class-level
9  * generation control. For example, in some case one method in
10  * a class needs to be different depending on the setting.
11  *
12  * <p>
13  * We also want to make sure that the runtime code can be compiled
14  * as a part of the XJC build.
15  *
16  * <p>
17  * To do this, the runtime code has a "meta-level" conditional statement
18  * marked by the comment "// META-IF".
19  * These conditional statements refer to static variables defined in this
20  * class, but they are actually evaluated by XJC and it will not
21  * generated parts of the code that won't be used.
22  *
23  * <p>
24  * For example, the following code in the runtime:
25  * <tt>
26  * if( MetaVariable.marshaller ) {// META-IF
27  * (A)
28  * } else {// META-IF
29  * (B)
30  * }
31  * </tt>
32  * <p>
33  * ... will be generated as <tt>(A)</tt> normally, but it will be
34  * generated as <tt>(B)</tt> if the user asks not to generate the
35  * marshaller.
36  *
37  * <p>
38  * This class won't be generated as a part of the runtime.
39  * It is necessary only to make the XJC compile.
40  *
41  * @author
42  * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
43  */

44 final class MetaVariable {
45     /** Marshaller/ */
46     static final boolean M = (System.getProperty("jaxb.runtime.M")==null);
47     /** Unmarshaller. */
48     static final boolean U = (System.getProperty("jaxb.runtime.U")==null);
49     /** Validator. */
50     static final boolean V = (System.getProperty("jaxb.runtime.V")==null);
51     /** Unmarshalling Validator. Why W? see, UV->VV->W! */
52     static final boolean W = (System.getProperty("jaxb.runtime.W")==null);
53 }
54
Popular Tags