Skip to content

Commit aec06c1

Browse files
hansonrhansonr
authored andcommitted
uses ObjectFactory (hack) to get QNAME
1 parent 519d437 commit aec06c1

File tree

11 files changed

+60
-9
lines changed

11 files changed

+60
-9
lines changed
1.92 KB
Binary file not shown.
31 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20181101060953
1+
20181101071341
1.92 KB
Binary file not shown.
31 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20181101060953
1+
20181101071341

sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptVisitor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,8 @@ public boolean visit(PackageDeclaration node) {
412412
if (annotations != null && annotations.size() > 0) {
413413
for (int i = 0; i < annotations.size(); i++)
414414
addAnnotation((Annotation) annotations.get(i), node, CHECK_ANNOTATIONS_ONLY);
415+
if (class_jaxbAccessorType == JAXB_TYPE_UNKNOWN)
416+
class_jaxbAccessorType = JAXB_TYPE_PUBLIC_MEMBER;
415417
}
416418
setPackage(node.getName().toString());
417419
return false;
@@ -6194,9 +6196,9 @@ static class ClassAnnotation {
61946196
private String qName;
61956197

61966198
protected ClassAnnotation(String qName, Annotation annotation, ASTNode node) {
6197-
// System.out.println(">>>>" + qName + " "
6199+
//System.out.println(">>>>" + qName + " "
61986200
//+ annotation.getClass().getName()
6199-
// + " " + annotation);
6201+
// + " " + annotation);
62006202
this.qName = qName;
62016203
this.annotation = annotation;
62026204
this.node = node;
1.92 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/xml/JSJAXBClass.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,25 @@ public void setQNameFromField0(QName qualifiedName) {
219219
String ns = qualifiedName.getNamespaceURI();
220220
if (ns.length() == 0) {
221221
if (defaultNamespace == null) {
222-
defaultNamespace = getDefaultNamespaceFromPackageInfo();
222+
defaultNamespace = getDefaultNamespaceFromObjectFactory();
223223
}
224224
qualifiedName = new QName(defaultNamespace == null ? "" : defaultNamespace, qualifiedName.getLocalPart(), "");
225225
}
226226
qname = qualifiedName;
227227
}
228228

229-
private String getDefaultNamespaceFromPackageInfo() {
229+
private String getDefaultNamespaceFromObjectFactory() {
230230
defaultNamespace = "";
231-
InputStream is = javaClass.getResourceAsStream("_$.js");
231+
232+
// C$._WebServiceParameterSet_QNAME=Clazz.new_(Clazz.load('javax.xml.namespace.QName').c$$S$S,["www.jalview.org/xml/wsparamset", "WebServiceParameterSet"]);
233+
// C$._JalviewModel_QNAME=Clazz.new_($I$(1).c$$S$S,["www.jalview.org", "JalviewModel"]);
234+
// C$._JalviewUserColours_QNAME=Clazz.new_($I$(1).c$$S$S,["www.jalview.org/colours", "JalviewUserColours"]);
235+
InputStream is = javaClass.getResourceAsStream("ObjectFactory.js");
232236
if (is != null) {
233237
String data = Rdr.streamToUTF8String(new BufferedInputStream(is));
234-
data = PT.getQuotedAttribute(data, "namespace");
238+
int ipt0 = data.indexOf("_" + javaClass.getSimpleName() + "_QNAME=Clazz");
239+
if (ipt0 > 0)
240+
data = PT.getQuotedStringAt(data, ipt0);
235241
if (data != null)
236242
defaultNamespace = data;
237243
}

sources/net.sf.j2s.java.core/src/swingjs/xml/JSJAXBField.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ private void processTypeAnnotation(JSJAXBClass jaxbClass, String tag, String dat
256256
// check package annotations
257257
switch (tag) {
258258
case "@XmlSchema":
259-
jaxbClass.qname = qualifiedName = getName(tag);
260259
return;
261260
}
262261

0 commit comments

Comments
 (0)