X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.xml.sax%2Fsrc%2Forg%2Fsimantics%2Fxml%2Fsax%2FJavaGenerator.java;h=bf52b9bac6889e608746176e9e14edbb316f92d7;hb=09fb8eafbc9046ead17f0529eebad0b0caf55e2b;hp=887bd1ec34e3611ccb0d715eaa6fba71d1abc7b2;hpb=404be73748777cdd2d09b2f29308ae6f4a3d730c;p=simantics%2Finterop.git diff --git a/org.simantics.xml.sax/src/org/simantics/xml/sax/JavaGenerator.java b/org.simantics.xml.sax/src/org/simantics/xml/sax/JavaGenerator.java index 887bd1e..bf52b9b 100644 --- a/org.simantics.xml.sax/src/org/simantics/xml/sax/JavaGenerator.java +++ b/org.simantics.xml.sax/src/org/simantics/xml/sax/JavaGenerator.java @@ -65,11 +65,11 @@ public abstract class JavaGenerator extends SchemaConversionBase{ return binding.getValueGetter(); } - public static String getComplexTypePrefix() { + public String getComplexTypePrefix() { return "ComplexTypes_"; } - public static String getAttributeGroupPrefix() { + public String getAttributeGroupPrefix() { return "AttributeGroups_"; } @@ -122,7 +122,7 @@ public abstract class JavaGenerator extends SchemaConversionBase{ } - public static String getName(SchemaObject obj) { + public String getName(SchemaObject obj) { if (obj.getParent() == null) { switch (obj.getType()) { case COMPLEX_TYPE: @@ -162,7 +162,7 @@ public abstract class JavaGenerator extends SchemaConversionBase{ } - public static String getName(SchemaObject obj, String rel) { + public String getName(SchemaObject obj, String rel) { if (obj.getParent() == null) { switch (obj.getType()) { case COMPLEX_TYPE: @@ -199,18 +199,7 @@ public abstract class JavaGenerator extends SchemaConversionBase{ throw new RuntimeException(); } - protected enum InheritanceType{ComplexType,AtomicType,None}; - protected class Inheritance { - public String baseClass; - public InheritanceType type; - public TypeEntry atomicType; - - public Inheritance(String baseClass) { - this.baseClass = baseClass; - this.type = InheritanceType.None; - } - } protected void writeClass(PrintWriter writer,boolean abst, String elementId, String className, String baseClass, List interfaces) { writer.println("@SuppressWarnings(\"unused\")"); @@ -235,63 +224,8 @@ public abstract class JavaGenerator extends SchemaConversionBase{ writer.println(); } - protected abstract String getBaseClass(); - protected Inheritance getElementInheritance(SchemaObject topLevelElementObj) { - Element topLevelElement = topLevelElementObj.getElement(); - Inheritance inheritance = new Inheritance(getBaseClass()); - if (topLevelElement.getType() != null) { - QName type = topLevelElement.getType(); - if (!type.getNamespaceURI().equals(SCHEMA_NS)) { - SchemaObject obj = complexTypeName.get(type.getLocalPart()); -// if (obj == null) -// obj = simpleTypeName.get(type.getLocalPart()); - if (obj != null) { - inheritance.baseClass = getName(obj); - inheritance.type = InheritanceType.ComplexType; - } - } else { - TypeEntry entry = getTypeEntry(type); - if (entry != null) { - inheritance.type = InheritanceType.AtomicType; - inheritance.atomicType = entry; - } - } - } - if (inheritance.type == InheritanceType.None) { - QName type = getElementBase(topLevelElement); - if (type != null) { - if (!type.getNamespaceURI().equals(SCHEMA_NS)) { - SchemaObject obj = getWithName(topLevelElementObj, type.getLocalPart()); - inheritance.baseClass = getName(obj); - inheritance.type = InheritanceType.ComplexType; - } else { - TypeEntry entry = getTypeEntry(type); - if (entry != null) { - inheritance.type = InheritanceType.AtomicType; - inheritance.atomicType = entry; - } - } - } - } - if (inheritance.type == InheritanceType.None) { - QName type = topLevelElement.getSubstitutionGroup(); - if (type != null) { - if (!type.getNamespaceURI().equals(SCHEMA_NS)) { - SchemaObject obj = getWithName(topLevelElementObj, type.getLocalPart()); - inheritance.baseClass = getName(obj); - inheritance.type = InheritanceType.ComplexType; - } else { - TypeEntry entry = getTypeEntry(type); - if (entry != null) { - inheritance.type = InheritanceType.AtomicType; - inheritance.atomicType = entry; - } - } - } - } - - return inheritance; - } + + }