Package com.sun.xml.bind.v2.runtime

Examples of com.sun.xml.bind.v2.runtime.JaxBeanInfo


/*     */
/*     */   public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
/* 102 */     Object v = this.acc.get(o);
/* 103 */     if (v != null)
/*     */       try {
/* 105 */         JaxBeanInfo bi = w.grammar.getBeanInfo(v, true);
/* 106 */         if ((bi.jaxbType == Object.class) && (this.domHandler != null))
/*     */         {
/* 109 */           w.writeDom(v, this.domHandler, o, this.fieldName);
/*     */         }
/* 111 */         else bi.serializeRoot(v, w);
/*     */       }
/*     */       catch (JAXBException e) {
/* 113 */         w.reportError(this.fieldName, e);
/*     */       }
/*     */   }
View Full Code Here


/* 129 */     return PropertyKind.REFERENCE;
/*     */   }
/*     */
/*     */   public Accessor getElementPropertyAccessor(String nsUri, String localName)
/*     */   {
/* 134 */     JaxBeanInfo bi = (JaxBeanInfo)this.expectedElements.get(nsUri, localName);
/* 135 */     if (bi != null) {
/* 136 */       if ((bi instanceof ElementBeanInfoImpl)) {
/* 137 */         ElementBeanInfoImpl ebi = (ElementBeanInfoImpl)bi;
/*     */
/* 139 */         return new Accessor(ebi.expectedType, ebi) {
View Full Code Here

/*  95 */     this.acceptedElements = new QName[prop.getTypes().size()];
/*  96 */     for (int i = 0; i < this.acceptedElements.length; i++) {
/*  97 */       this.acceptedElements[i] = ((RuntimeTypeRef)prop.getTypes().get(i)).getTagName();
/*     */     }
/*  99 */     for (RuntimeTypeRef e : prop.getTypes()) {
/* 100 */       JaxBeanInfo beanInfo = context.getOrCreate(e.getTarget());
/* 101 */       if (nt == null) nt = e.getTagName();
/* 102 */       this.typeNames.put(beanInfo.jaxbType, new TagAndType(context.nameBuilder.createElementName(e.getTagName()), beanInfo));
/*     */
/* 104 */       nil |= e.isNillable();
/*     */     }
View Full Code Here

/*     */
/*     */   public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
/* 162 */     JAXBContextImpl context = chain.context;
/*     */
/* 164 */     for (TypeRef e : this.prop.getTypes()) {
/* 165 */       JaxBeanInfo bi = context.getOrCreate((RuntimeTypeInfo)e.getTarget());
/*     */
/* 168 */       Loader l = bi.getLoader(context, !Modifier.isFinal(bi.jaxbType.getModifiers()));
/* 169 */       if (e.getDefaultValue() != null)
/* 170 */         l = new DefaultValueLoaderDecorator(l, e.getDefaultValue());
/* 171 */       if ((this.nillable) || (chain.context.allNillable))
/* 172 */         l = new XsiNilLoader.Single(l, this.acc);
/* 173 */       handlers.put(e.getTagName(), new ChildLoader(l, this.acc));
View Full Code Here

/*     */   public ArrayReferenceNodeProperty(JAXBContextImpl p, RuntimeReferencePropertyInfo prop)
/*     */   {
/*  80 */     super(p, prop, prop.getXmlName(), prop.isCollectionNillable());
/*     */
/*  82 */     for (RuntimeElement e : prop.getElements()) {
/*  83 */       JaxBeanInfo bi = p.getOrCreate(e);
/*  84 */       this.expectedElements.put(e.getElementName().getNamespaceURI(), e.getElementName().getLocalPart(), bi);
/*     */     }
/*     */
/*  87 */     this.isMixed = prop.isMixed();
/*     */
View Full Code Here

/* 103 */         Object item = itr.next();
/* 104 */         if (item != null)
/* 105 */           if ((this.isMixed) && (item.getClass() == String.class)) {
/* 106 */             w.text((String)item, null);
/*     */           } else {
/* 108 */             JaxBeanInfo bi = w.grammar.getBeanInfo(item, true);
/* 109 */             if ((bi.jaxbType == Object.class) && (this.domHandler != null))
/*     */             {
/* 112 */               w.writeDom(item, this.domHandler, o, this.fieldName);
/*     */             }
/* 114 */             else bi.serializeRoot(item, w);
/*     */           }
/*     */       }
/*     */       catch (JAXBException e)
/*     */       {
/* 118 */         w.reportError(this.fieldName, e);
View Full Code Here

/* 125 */     int offset = chain.allocateOffset();
/*     */
/* 127 */     Receiver recv = new ArrayERProperty.ReceiverImpl(this, offset);
/*     */
/* 129 */     for (QNameMap.Entry n : this.expectedElements.entrySet()) {
/* 130 */       JaxBeanInfo beanInfo = (JaxBeanInfo)n.getValue();
/* 131 */       loaders.put(n.nsUri, n.localName, new ChildLoader(beanInfo.getLoader(chain.context, true), recv));
/*     */     }
/*     */
/* 134 */     if (this.isMixed)
/*     */     {
/* 136 */       loaders.put(TEXT_HANDLER, new ChildLoader(new MixedTextLoader(recv), null));
View Full Code Here

/* 103 */     for (RuntimeTypeRef typeRef : types) {
/* 104 */       Class type = (Class)typeRef.getTarget().getType();
/* 105 */       if (type.isPrimitive()) {
/* 106 */         type = (Class)RuntimeUtil.primitiveToBox.get(type);
/*     */       }
/* 108 */       JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget());
/* 109 */       TagAndType tt = new TagAndType(grammar.nameBuilder.createElementName(typeRef.getTagName()), beanInfo);
/*     */
/* 112 */       this.typeMap.put(type, tt);
/* 113 */       this.refs.put(typeRef, beanInfo);
/* 114 */       if ((typeRef.isNillable()) && (n == null)) {
View Full Code Here

                return;
            }

            // the registry doesn't know about this element.
            // try its xsi:type
            JaxBeanInfo beanInfo = XsiTypeLoader.parseXsiType(state, ea, null);
            if(beanInfo==null) {
                // we don't even know its xsi:type
                reportUnexpectedChildElement(ea,false);
                return;
            }

            state.loader = beanInfo.getLoader(null,false);
            state.prev.backup = new JAXBElement<Object>(ea.createQName(),Object.class,null);
            state.receiver = this;
        }
View Full Code Here

        super(true);
        this.defaultBeanInfo = defaultBeanInfo;
    }

    public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
        JaxBeanInfo beanInfo = parseXsiType(state,ea,defaultBeanInfo);
        if(beanInfo==null)
            beanInfo = defaultBeanInfo;

        Loader loader = beanInfo.getLoader(null,false);
        state.loader = loader;
        loader.startElement(state,ea);
    }
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.v2.runtime.JaxBeanInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.