public JAXBModelImpl( TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> types, AnnotationReader<TypeMirror, TypeElement, VariableElement, ExecutableElement> reader, Collection<Reference> rootClasses, Map<QName, Reference> additionalElementDecls) { this.types = types; this.reader = reader; this.additionalElementDecls = additionalElementDecls; Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> navigator = types.getNavigator(); for (ClassInfo<TypeMirror, TypeElement> i : types.beans().values()) { classList.add(i.getName()); } for (ArrayInfo<TypeMirror, TypeElement> a : types.arrays().values()) { String javaName = navigator.getTypeName(a.getType()); classList.add(javaName); } for (EnumLeafInfo<TypeMirror, TypeElement> l : types.enums().values()) { QName tn = l.getTypeName(); if (tn != null) { String javaName = navigator.getTypeName(l.getType()); classList.add(javaName); } } for (Reference ref : rootClasses) refMap.put(ref, getXmlType(ref)); // check for collision between "additional" ones and the ones given to JAXB // and eliminate duplication Iterator<Map.Entry<QName, Reference>> itr = additionalElementDecls.entrySet().iterator(); while (itr.hasNext()) { Map.Entry<QName, Reference> entry = itr.next(); if (entry.getValue() == null) continue; NonElement<TypeMirror, TypeElement> xt = getXmlType(entry.getValue()); assert xt != null; refMap.put(entry.getValue(), xt); if (xt instanceof ClassInfo) { ClassInfo<TypeMirror, TypeElement> xct = (ClassInfo<TypeMirror, TypeElement>) xt; Element<TypeMirror, TypeElement> elem = xct.asElement(); if (elem != null && elem.getElementName().equals(entry.getKey())) { itr.remove(); continue; } } ElementInfo<TypeMirror, TypeElement> ei = types.getElementInfo(null, entry.getKey()); if (ei != null && ei.getContentType() == xt) itr.remove(); } }
public Location getLocation() { return nav.getFieldLocation(field); }