public int compareTo(Object o) { int c = -1; if (o instanceof JBossXSParticle) { JBossXSParticle w = (JBossXSParticle)o; String oname = w.getTerm().getName(); String termName = term.getName(); if (termName != null && oname != null) c = termName.compareTo(oname); else if (termName == null) c = -1; else c = 1; //In the case of doclit, need to be careful about String_1,SimpleType_2 if (termName != null && oname != null) { char num1 = termName.charAt(termName.length() - 1); char num2 = oname.charAt(oname.length() - 1); if (Character.isDigit(num1) && Character.isDigit(num2)) c = ("" + num1).compareTo(("" + num2)); } } return c; }
private GmlPropertyDefinition getProperty(XSParticle particle, String propertyNamespaceUri, String propertyLocalName) { XSTerm term = particle.getTerm(); if ((term instanceof XSElementDeclaration)) { if ((term.getNamespace().equals(propertyNamespaceUri)) && (term.getName().equals(propertyLocalName))) return new XPsviGmlPropertyDefinition(this.model, particle); } else if ((term instanceof XSModelGroup)) { XSModelGroup modelGroup = (XSModelGroup) term; XSObjectList particles = modelGroup.getParticles(); for (int i = 0; i < particles.getLength(); i++) { GmlPropertyDefinition property = getProperty( (XSParticle) particles.item(i), propertyNamespaceUri, propertyLocalName); if (property != null) { return property; } } } return null; }
private void addVariableMappings(Class<?> javaType, JavaXmlTypeMapping javaXmlTypeMapping, List<XSParticle> particles, Map<String, String> reversedNames) { for (XSParticle particle : particles) { XSTerm term = particle.getTerm(); if (term.getType() == XSConstants.MODEL_GROUP) { XSModelGroup group = (XSModelGroup)term; XSObjectList list = group.getParticles(); ArrayList<XSParticle> baseParticles = new ArrayList<XSParticle>(); for (int i = 0; i < list.getLength(); i++) baseParticles.add((XSParticle)list.item(i)); addVariableMappings(javaType, javaXmlTypeMapping, baseParticles, null); continue; } String name = term.getName(); String variableName = name; if (reversedNames != null && reversedNames.get(name) != null) variableName = reversedNames.get(name); VariableMapping mapping = new VariableMapping(javaXmlTypeMapping); mapping.setJavaVariableName(variableName); mapping.setXmlElementName(name); mapping.setDataMember(utils.doesPublicFieldExist(javaType, variableName)); if (isAlreadyMapped(javaXmlTypeMapping, mapping) == false) { javaXmlTypeMapping.addVariableMapping(mapping); } } }
final String msg = "Internal error. Unhandled term type: " + term.getName(); throw new RuntimeException( msg );
String msg = "Internal error. Unhandled term type: " + particle.getTerm().getName(); throw new RuntimeException( msg );
for (int i = 0; i < particles.getLength(); i++) { XSParticle p = (XSParticle) particles.item(i); if (definition.containsKey(p.getTerm().getName())) { list.add(p); } else { if (def != null) { Object val = def.get(term.getName()); if (val != null) { if (val instanceof Map) { Map<String, Object> definition = (Map<String, Object>) val; stack.push(new StackItem(term, item, term.getName(), definition, null)); add = true; } else if (val instanceof List) { value = t; stack.push(new StackItem(term, item, term.getName(), definition, value)); add = true; stack.push(new StackItem(term, item, term.getName(), null, val)); add = true; stack.push(new StackItem(term, item, term.getName(), null, null));