KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.sun.tools.xjc.runtime;
2
3 import javax.xml.bind.JAXBException;
4
5 /**
6  * Keeps the information about the grammar as a whole.
7  *
8  * Implementation of this interface is provided by the generated code.
9  *
10  * @author
11  * <a HREF="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
12  */

13 public interface GrammarInfo
14 {
15 // META-IF(U)
16
/**
17      * Creates an unmarshaller that can unmarshal a given element.
18      *
19      * @param namespaceUri
20      * The string needs to be interned by the caller
21      * for a performance reason.
22      * @param localName
23      * The string needs to be interned by the caller
24      * for a performance reason.
25      *
26      * @return
27      * null if the given name pair is not recognized.
28      */

29     UnmarshallingEventHandler createUnmarshaller(
30         String JavaDoc namespaceUri, String JavaDoc localName, UnmarshallingContext context );
31     
32     /**
33      * Creates an instance for the root element.
34      *
35      * @return
36      * null if the given name pair is not recognized.
37      */

38     Class JavaDoc getRootElement(String JavaDoc namespaceUri, String JavaDoc localName);
39     
40     /**
41      * Return the probe points for this GrammarInfo, which are used to detect
42      * {namespaceURI,localName} collisions across the GrammarInfo's on the
43      * schemaPath. This is a slightly more complex implementation than a simple
44      * hashmap, but it is more flexible in supporting additional schema langs.
45      */

46     String JavaDoc[] getProbePoints();
47     
48     /**
49      * Returns true if the invocation of the createUnmarshaller method
50      * will return a non-null value for the given name pair.
51      *
52      * @param nsUri
53      * The string needs to be interned by the caller
54      * for a performance reason.
55      * @param localName
56      * The string needs to be interned by the caller
57      * for a performance reason.
58      */

59     boolean recognize( String JavaDoc nsUri, String JavaDoc localName );
60 // META-ENDIF
61

62     /**
63      * Gets the default implementation for the given public content
64      * interface.
65      *
66      * @param javaContentInterface
67      * the Class object of the public interface.
68      *
69      * @return null
70      * If the interface is not found.
71      */

72     Class JavaDoc getDefaultImplementation( Class JavaDoc javaContentInterface );
73
74 // META-IF(W)
75
/**
76      * Gets the MSV AGM which can be used to validate XML during
77      * marshalling/unmarshalling.
78      */

79     com.sun.msv.grammar.Grammar getGrammar() throws JAXBException;
80 // META-ENDIF
81

82     
83 // META-IF(V|M)
84
XMLSerializable castToXMLSerializable( Object JavaDoc o );
85 // META-ENDIF
86

87     
88 // META-IF(V)
89
ValidatableObject castToValidatableObject(Object JavaDoc o);
90 // META-ENDIF
91
}
92
Popular Tags