25 |
25 |
26 package com.sun.xml.internal.bind.v2.model.impl; |
26 package com.sun.xml.internal.bind.v2.model.impl; |
27 |
27 |
28 import javax.xml.namespace.QName; |
28 import javax.xml.namespace.QName; |
29 |
29 |
30 import com.sun.xml.internal.bind.v2.TODO; |
|
31 import com.sun.xml.internal.bind.v2.WellKnownNamespace; |
|
32 import com.sun.xml.internal.bind.v2.model.annotation.Locatable; |
30 import com.sun.xml.internal.bind.v2.model.annotation.Locatable; |
33 import com.sun.xml.internal.bind.v2.model.core.ArrayInfo; |
31 import com.sun.xml.internal.bind.v2.model.core.ArrayInfo; |
34 import com.sun.xml.internal.bind.v2.model.core.NonElement; |
32 import com.sun.xml.internal.bind.v2.model.core.NonElement; |
|
33 import com.sun.xml.internal.bind.v2.model.util.ArrayInfoUtil; |
35 import com.sun.xml.internal.bind.v2.runtime.Location; |
34 import com.sun.xml.internal.bind.v2.runtime.Location; |
36 import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; |
35 import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; |
37 |
36 |
38 /** |
37 /** |
39 * |
38 * |
66 if(n==null) { |
65 if(n==null) { |
67 builder.reportError(new IllegalAnnotationException(Messages.ANONYMOUS_ARRAY_ITEM.format( |
66 builder.reportError(new IllegalAnnotationException(Messages.ANONYMOUS_ARRAY_ITEM.format( |
68 nav().getTypeName(componentType)),this)); |
67 nav().getTypeName(componentType)),this)); |
69 n = new QName("#dummy"); // for error recovery |
68 n = new QName("#dummy"); // for error recovery |
70 } |
69 } |
71 this.typeName = calcArrayTypeName(n); |
70 this.typeName = ArrayInfoUtil.calcArrayTypeName(n); |
72 } |
|
73 |
|
74 /** |
|
75 * Computes the type name of the array from that of the item type. |
|
76 */ |
|
77 public static QName calcArrayTypeName(QName n) { |
|
78 String uri; |
|
79 if(n.getNamespaceURI().equals(WellKnownNamespace.XML_SCHEMA)) { |
|
80 TODO.checkSpec("this URI"); |
|
81 uri = "http://jaxb.dev.java.net/array"; |
|
82 } else |
|
83 uri = n.getNamespaceURI(); |
|
84 return new QName(uri,n.getLocalPart()+"Array"); |
|
85 } |
71 } |
86 |
72 |
87 public NonElement<TypeT, ClassDeclT> getItemType() { |
73 public NonElement<TypeT, ClassDeclT> getItemType() { |
88 return itemType; |
74 return itemType; |
89 } |
75 } |