|
1 /* |
|
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 package com.sun.tools.internal.xjc.reader.xmlschema.ct; |
|
27 |
|
28 import com.sun.tools.internal.xjc.ErrorReceiver; |
|
29 import com.sun.tools.internal.xjc.reader.Ring; |
|
30 import com.sun.tools.internal.xjc.reader.xmlschema.BGMBuilder; |
|
31 import com.sun.tools.internal.xjc.reader.xmlschema.BindGreen; |
|
32 import com.sun.tools.internal.xjc.reader.xmlschema.ClassSelector; |
|
33 import com.sun.tools.internal.xjc.reader.xmlschema.SimpleTypeBuilder; |
|
34 import com.sun.xml.internal.xsom.XSComplexType; |
|
35 import com.sun.xml.internal.xsom.XSSchemaSet; |
|
36 |
|
37 /** |
|
38 * Builds a field expression from a complex type. |
|
39 * |
|
40 * Depending on a "kind" of complex type, the binding is |
|
41 * quite different. For example, how a complex type is bound |
|
42 * when it is extended from another complex type is very |
|
43 * different from how it's bound when it has, say, mixed content model. |
|
44 * |
|
45 * Each different algorithm of binding a complex type is implemented |
|
46 * as an implementation of this interface. |
|
47 * |
|
48 * @author |
|
49 * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) |
|
50 */ |
|
51 abstract class CTBuilder { |
|
52 /** |
|
53 * Returns true if this owner can handle the given complex type. |
|
54 */ |
|
55 abstract boolean isApplicable(XSComplexType ct); |
|
56 |
|
57 /** |
|
58 * Binds the given complex type. This method will be called |
|
59 * only when the <code>isApplicable</code> method returns true. |
|
60 */ |
|
61 abstract void build(XSComplexType ct); |
|
62 |
|
63 protected final ComplexTypeFieldBuilder builder = Ring.get(ComplexTypeFieldBuilder.class); |
|
64 protected final ClassSelector selector = Ring.get(ClassSelector.class); |
|
65 protected final SimpleTypeBuilder simpleTypeBuilder = Ring.get(SimpleTypeBuilder.class); |
|
66 protected final ErrorReceiver errorReceiver = Ring.get(ErrorReceiver.class); |
|
67 protected final BindGreen green = Ring.get(BindGreen.class); |
|
68 protected final XSSchemaSet schemas = Ring.get(XSSchemaSet.class); |
|
69 protected final BGMBuilder bgmBuilder = Ring.get(BGMBuilder.class); |
|
70 } |