Skip to content

Commit 729b117

Browse files
hansonrhansonr
authored andcommitted
JAXB marshaller working; preliminary work on unmarshaller
1 parent fa83f71 commit 729b117

31 files changed

+890
-809
lines changed
10.2 KB
Binary file not shown.
279 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20181014234526
1+
20181016101634
10.2 KB
Binary file not shown.
279 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20181014234526
1+
20181016101634

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4239,7 +4239,7 @@ private boolean isStaticBinding(IVariableBinding varBinding) {
42394239
return (isStatic(varBinding) && varBinding.getDeclaringClass() != null);
42404240
}
42414241

4242-
private static String getJavaClassNameQualified(ITypeBinding binding) {
4242+
static String getJavaClassNameQualified(ITypeBinding binding) {
42434243
String binaryName = null, bindingKey;
42444244

42454245
// about binding.isLocal()
@@ -5334,6 +5334,7 @@ private Object checkAnnotations(BodyDeclaration node, String tagName) {
53345334
}
53355335
List<?> modifiers = node.modifiers();
53365336
if (modifiers != null && modifiers.size() > 0) {
5337+
53375338
for (Iterator<?> iter = modifiers.iterator(); iter.hasNext();) {
53385339
Object obj = iter.next();
53395340
if (obj instanceof Annotation) {
@@ -6138,6 +6139,7 @@ public static void addClassAnnotations(List<ClassAnnotation> class_annotations,
61386139
if (class_annotations == null)
61396140
return;
61406141
int pt = 0;
6142+
ASTNode lastNode = null;
61416143
for (int i = 0; i < class_annotations.size(); i++) {
61426144
ClassAnnotation a = class_annotations.get(i);
61436145
String str = a.annotation.toString();
@@ -6159,26 +6161,40 @@ public static void addClassAnnotations(List<ClassAnnotation> class_annotations,
61596161
// }
61606162
String nodeType = a.qName;
61616163
String varName = null;
6164+
String className = null, binaryName = null;
61626165
if (a.node instanceof FieldDeclaration) {
61636166
FieldDeclaration field = (FieldDeclaration) a.node;
61646167
List<?> fragments = field.fragments();
61656168
VariableDeclarationFragment identifier = (VariableDeclarationFragment) fragments.get(0);
61666169
IVariableBinding var = identifier.resolveBinding();
6170+
className = getJavaClassNameQualified(var.getType());
6171+
binaryName = var.getType().getBinaryName();
61676172
nodeType = (var.getType().isArray() ? "[array]" : field.getType().toString());
6173+
var.getType().getQualifiedName();
61686174
varName = var.getName();
61696175
} else if (a.node instanceof MethodDeclaration) {
61706176
MethodDeclaration method = (MethodDeclaration) a.node;
61716177
IMethodBinding var = method.resolveBinding();
61726178
ITypeBinding type = var.getReturnType();
6179+
className = getJavaClassNameQualified(type);
6180+
binaryName = type.getBinaryName();
61736181
nodeType = (type.isArray() ? "[array]" : type.getName());
61746182
varName = "M:" + var.getName();
61756183
}
6176-
trailingBuffer.append(pt++ == 0 ? "C$.__ANN__ = [\n " : " ,");
6177-
trailingBuffer.append("[" + (varName == null ? null : "'" + varName + "'")
6178-
+ ",'" + nodeType + "','" + str + "']\n");
6184+
if (a.node == lastNode) {
6185+
trailingBuffer.append(",");
6186+
} else {
6187+
lastNode = a.node;
6188+
trailingBuffer.append(pt++ == 0 ? "C$.__ANN__ = [[[" : "]],\n [[");
6189+
trailingBuffer.append((varName == null ? null : "'" + varName + "'")
6190+
+ ",'" + nodeType + "'"
6191+
+ ",'" + className + "'"
6192+
+ ",'" + binaryName + "'],[");
6193+
}
6194+
trailingBuffer.append("'" + str + "'");
61796195
}
61806196
if (pt > 0)
6181-
trailingBuffer.append("];\n");
6197+
trailingBuffer.append("]]];\n");
61826198
}
61836199

61846200
}

sources/net.sf.j2s.java.core/src/javax/xml/datatype/DatatypeFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected DatatypeFactory() {
3131
}
3232

3333
public static DatatypeFactory newInstance() throws DatatypeConfigurationException {
34-
return (DatatypeFactory) Interface.getInstance("swingjs.JSJAXBDatatypeFactory", false);
34+
return (DatatypeFactory) Interface.getInstance("swingjs.xml.JSJAXBDatatypeFactory", false);
3535
}
3636

3737
public abstract Duration newDuration(String s);

sources/net.sf.j2s.java.core/src/javax/xml/parsers/SAXParserFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
*
2323
* SwingJS note: These class in the JDK is abstract. Here we allow instantiation
24-
* just of this. The default parser created is swingjs.JSSAXParser, a minimal implementation,
24+
* just of this. The default parser created is swingjs.xml.JSSAXParser, a minimal implementation,
2525
* but this default can be set by the developer on the page using
2626
*
2727
* System.setProperty("org.xml.sax.parser", fullClassName);
@@ -134,8 +134,8 @@ public SAXParser newSAXParser() throws ParserConfigurationException, SAXExceptio
134134
*/
135135
public static Parser makeParser() throws ClassNotFoundException, IllegalAccessException, InstantiationException,
136136
NullPointerException, ClassCastException {
137-
// SwingJS -- directs to swingjs.JSSAXParser
138-
String className = System.getProperty("org.xml.sax.parser", "swingjs.JSSAXParser");
137+
// SwingJS -- directs to swingjs.xml.JSSAXParser
138+
String className = System.getProperty("org.xml.sax.parser", "swingjs.xml.JSSAXParser");
139139
if (className == null) {
140140
throw new NullPointerException("No value for sax.parser property");
141141
} else {

sources/net.sf.j2s.java.core/src/javax/xml/transform/stream/StreamResult.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
import javax.xml.transform.Result;
88

9-
import swingjs.JSXMLStreamResult;
10-
11-
public class StreamResult extends JSXMLStreamResult implements Result {
9+
public class StreamResult extends swingjs.xml.JSXMLStreamResult implements Result {
1210

1311
public StreamResult() {
1412
super();

0 commit comments

Comments
 (0)