author | mkos |
Sun, 30 Dec 2012 00:00:00 +0100 | |
changeset 22678 | ac1ea46be942 |
parent 12009 | 4abb694f273a |
permissions | -rw-r--r-- |
12009 | 1 |
/* |
22678
ac1ea46be942
8029237: Update copyright year to match last edit in jaxws repository for 2012
mkos
parents:
12009
diff
changeset
|
2 |
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
12009 | 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.dtd.bindinfo; |
|
27 |
||
28 |
import java.util.ArrayList; |
|
29 |
import java.util.List; |
|
30 |
import java.util.StringTokenizer; |
|
31 |
||
32 |
import com.sun.tools.internal.xjc.model.CClassInfo; |
|
33 |
||
34 |
import org.w3c.dom.Element; |
|
35 |
import org.xml.sax.Locator; |
|
36 |
||
37 |
/** |
|
38 |
* <constructor> declaration in the binding file. |
|
39 |
* |
|
40 |
* <p> |
|
41 |
* Since JAXB will generate both interfaces and implementations, |
|
42 |
* A constructor declaration will create: |
|
43 |
* |
|
44 |
* <ul> |
|
45 |
* <li> a method declaration in the factory interface |
|
46 |
* <li> a method implementation in the factory implementation class |
|
47 |
* <li> a constructor implementation in the actual implementation class |
|
48 |
* </ul> |
|
49 |
*/ |
|
50 |
public class BIConstructor |
|
51 |
{ |
|
52 |
BIConstructor( Element _node ) { |
|
53 |
this.dom = _node; |
|
54 |
||
55 |
StringTokenizer tokens = new StringTokenizer( |
|
56 |
DOMUtil.getAttribute(_node,"properties")); |
|
57 |
||
58 |
List<String> vec = new ArrayList<String>(); |
|
59 |
while(tokens.hasMoreTokens()) |
|
60 |
vec.add(tokens.nextToken()); |
|
61 |
properties = vec.toArray(new String[0]); |
|
62 |
||
63 |
if( properties.length==0 ) |
|
64 |
throw new AssertionError("this error should be catched by the validator"); |
|
65 |
} |
|
66 |
||
67 |
/** <constructor> element in the source binding file. */ |
|
68 |
private final Element dom; |
|
69 |
||
70 |
/** properties specified by @properties. */ |
|
71 |
private final String[] properties; |
|
72 |
||
73 |
/** |
|
74 |
* Creates a constructor declaration into the ClassItem. |
|
75 |
* |
|
76 |
* @param cls |
|
77 |
* ClassItem object that corresponds to the |
|
78 |
* element declaration that contains this declaration. |
|
79 |
*/ |
|
80 |
public void createDeclaration( CClassInfo cls ) { |
|
81 |
cls.addConstructor(properties); |
|
82 |
} |
|
83 |
||
84 |
/** Gets the location where this declaration is declared. */ |
|
85 |
public Locator getSourceLocation() { |
|
86 |
return DOMLocator.getLocationInfo(dom); |
|
87 |
} |
|
88 |
||
89 |
||
90 |
} |