protected ElementInfoImpl<T,C,F,M> createElementInfo( RegistryInfoImpl<T,C,F,M> registryInfo, M m) throws IllegalAnnotationException { return new ElementInfoImpl<T,C,F,M>(this,registryInfo,m); }
/** * Called after all the {@link TypeInfo}s are collected into the {@link #owner}. */ /*package*/ void link() { // substitution head if(anno.substitutionHeadName().length()!=0) { QName name = new QName( anno.substitutionHeadNamespace(), anno.substitutionHeadName() ); substitutionHead = owner.getElementInfo(null,name); if(substitutionHead==null) { builder.reportError( new IllegalAnnotationException(Messages.NON_EXISTENT_ELEMENT_MAPPING.format( name.getNamespaceURI(),name.getLocalPart()), anno)); // recover by ignoring this substitution declaration } else substitutionHead.addSubstitutionMember(this); } else substitutionHead = null; super.link(); }
anno = reader().getMethodAnnotation( XmlElementDecl.class, m, this ); assert anno!=null; // the caller should check this assert anno instanceof Locatable; elementType = nav().getReturnType(m); T baseClass = nav().getBaseClass(elementType,nav().asDecl(JAXBElement.class)); if(baseClass==null) throw new IllegalAnnotationException( Messages.XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD.format(nav().getMethodName(m)), anno ); tagName = parseElementName(anno); T[] methodParams = nav().getMethodParameters(m); XmlJavaTypeAdapter adapter = reader().getMethodAnnotation(XmlJavaTypeAdapter.class,m,this); if(adapter!=null) a = new Adapter<T,C>(adapter,reader(),nav()); else { XmlAttachmentRef xsa = reader().getMethodAnnotation(XmlAttachmentRef.class,m,this); if(xsa!=null) { TODO.prototype("in Annotation Processing swaRefAdapter isn't avaialble, so this returns null"); : nav().getTypeArgument(baseClass,0); // fall back to infer from the return type if no parameter. T list = nav().getBaseClass(tOfJAXBElementT,nav().asDecl(List.class)); if(list==null) { isCollection = false; } else {
/** * @param builder * used for reporting errors. */ public final void add( ElementInfoImpl<T,C,F,M> ei, ModelBuilder<T,C,F,M> builder ) { C scope = null; if(ei.getScope()!=null) scope = ei.getScope().getClazz(); Map<QName,ElementInfoImpl<T,C,F,M>> m = elementMappings.get(scope); if(m==null) elementMappings.put(scope,m=new LinkedHashMap<QName,ElementInfoImpl<T,C,F,M>>()); ElementInfoImpl<T,C,F,M> existing = m.put(ei.getElementName(),ei); if(existing!=null) { QName en = ei.getElementName(); builder.reportError( new IllegalAnnotationException( Messages.CONFLICTING_XML_ELEMENT_MAPPING.format(en.getNamespaceURI(),en.getLocalPart()), ei, existing )); } }
public Class<? extends JAXBElement> getType() { //noinspection unchecked return (Class<? extends JAXBElement>) Utils.REFLECTION_NAVIGATOR.erasure(super.getType()); }
public RuntimeNonElement getContentType() { return (RuntimeNonElement)super.getContentType(); } }
public RuntimeElementPropertyInfo getProperty() { return (RuntimeElementPropertyInfo)super.getProperty(); }
public RuntimeClassInfo getScope() { return (RuntimeClassInfo)super.getScope(); }
/** * @param builder * used for reporting errors. */ public final void add( ElementInfoImpl<T,C,F,M> ei, ModelBuilder<T,C,F,M> builder ) { C scope = null; if(ei.getScope()!=null) scope = ei.getScope().getClazz(); Map<QName,ElementInfoImpl<T,C,F,M>> m = elementMappings.get(scope); if(m==null) elementMappings.put(scope,m=new LinkedHashMap<QName,ElementInfoImpl<T,C,F,M>>()); ElementInfoImpl<T,C,F,M> existing = m.put(ei.getElementName(),ei); if(existing!=null) { QName en = ei.getElementName(); builder.reportError( new IllegalAnnotationException( Messages.CONFLICTING_XML_ELEMENT_MAPPING.format(en.getNamespaceURI(),en.getLocalPart()), ei, existing )); } }
public Class<? extends JAXBElement> getType() { //noinspection unchecked return (Class<? extends JAXBElement>) Utils.REFLECTION_NAVIGATOR.erasure(super.getType()); }
public RuntimeNonElement getContentType() { return (RuntimeNonElement)super.getContentType(); } }
public RuntimeElementPropertyInfo getProperty() { return (RuntimeElementPropertyInfo)super.getProperty(); }
public RuntimeClassInfo getScope() { return (RuntimeClassInfo)super.getScope(); }
anno = reader().getMethodAnnotation( XmlElementDecl.class, m, this ); assert anno!=null; // the caller should check this assert anno instanceof Locatable; elementType = nav().getReturnType(m); T baseClass = nav().getBaseClass(elementType,nav().asDecl(JAXBElement.class)); if(baseClass==null) throw new IllegalAnnotationException( Messages.XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD.format(nav().getMethodName(m)), anno ); tagName = parseElementName(anno); T[] methodParams = nav().getMethodParameters(m); XmlJavaTypeAdapter adapter = reader().getMethodAnnotation(XmlJavaTypeAdapter.class,m,this); if(adapter!=null) a = new Adapter<T,C>(adapter,reader(),nav()); else { XmlAttachmentRef xsa = reader().getMethodAnnotation(XmlAttachmentRef.class,m,this); if(xsa!=null) { TODO.prototype("in Annotation Processing swaRefAdapter isn't avaialble, so this returns null"); : nav().getTypeArgument(baseClass,0); // fall back to infer from the return type if no parameter. T list = nav().getBaseClass(tOfJAXBElementT,nav().asDecl(List.class)); if(list==null) { isCollection = false; } else {
/** * @param builder * used for reporting errors. */ public final void add( ElementInfoImpl<T,C,F,M> ei, ModelBuilder<T,C,F,M> builder ) { C scope = null; if(ei.getScope()!=null) scope = ei.getScope().getClazz(); Map<QName,ElementInfoImpl<T,C,F,M>> m = elementMappings.get(scope); if(m==null) elementMappings.put(scope,m=new LinkedHashMap<QName,ElementInfoImpl<T,C,F,M>>()); ElementInfoImpl<T,C,F,M> existing = m.put(ei.getElementName(),ei); if(existing!=null) { QName en = ei.getElementName(); builder.reportError( new IllegalAnnotationException( Messages.CONFLICTING_XML_ELEMENT_MAPPING.format(en.getNamespaceURI(),en.getLocalPart()), ei, existing )); } }
protected ElementInfoImpl<T,C,F,M> createElementInfo( RegistryInfoImpl<T,C,F,M> registryInfo, M m) throws IllegalAnnotationException { return new ElementInfoImpl<T,C,F,M>(this,registryInfo,m); }
public Class<? extends JAXBElement> getType() { //noinspection unchecked return (Class<? extends JAXBElement>) Utils.REFLECTION_NAVIGATOR.erasure(super.getType()); }
public RuntimeNonElement getContentType() { return (RuntimeNonElement)super.getContentType(); } }
public RuntimeElementPropertyInfo getProperty() { return (RuntimeElementPropertyInfo)super.getProperty(); }
public RuntimeClassInfo getScope() { return (RuntimeClassInfo)super.getScope(); }