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

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


    public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        JAXBContextImpl context = chain.context;

        for (TypeRef<Type,Class> e : prop.getTypes()) {
            JaxBeanInfo bi = context.getOrCreate((RuntimeTypeInfo) e.getTarget());
            // if the expected Java type is already final, type substitution won't really work anyway.
            // this also traps cases like trying to substitute xsd:long element with xsi:type='xsd:int'
            Loader l = bi.getLoader(context,!Modifier.isFinal(bi.jaxbType.getModifiers()));
            if(e.getDefaultValue()!=null)
                l = new DefaultValueLoaderDecorator(l,e.getDefaultValue());
            if(nillable || chain.context.allNillable)
                l = new XsiNilLoader.Single(l,acc);
            handlers.put( e.getTagName(), new ChildLoader(l,acc));
View Full Code Here


        for (RuntimeTypeRef typeRef : types) {
            Class type = (Class)typeRef.getTarget().getType();
            if(type.isPrimitive())
                type = RuntimeUtil.primitiveToBox.get(type);

            JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget());
            TagAndType tt = new TagAndType(
                                grammar.nameBuilder.createElementName(typeRef.getTagName()),
                                beanInfo);
            typeMap.put(type,tt);
            refs.put(typeRef,beanInfo);
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

        loader.startElement(state,ea);
    }

    /*pacakge*/ static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
        UnmarshallingContext context = state.getContext();
        JaxBeanInfo beanInfo = null;

        // look for @xsi:type
        Attributes atts = ea.atts;
        int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");

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

    }

    protected Loader selectLoader(UnmarshallingContext.State state, TagName ea) throws SAXException {

        UnmarshallingContext context = state.getContext();
        JaxBeanInfo beanInfo = null;

        // look for @xsi:type
        Attributes atts = ea.atts;
        int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE, "type");
View Full Code Here

/*      */
/*  334 */       if (this.classResolver != null) {
/*  335 */         Class clazz = this.classResolver.resolveElementName(tag.uri, tag.local);
/*  336 */         if (clazz != null) {
/*  337 */           JAXBContextImpl enhanced = getJAXBContext().createAugmented(clazz);
/*  338 */           JaxBeanInfo bi = enhanced.getBeanInfo(clazz);
/*  339 */           return bi.getLoader(enhanced, true);
/*      */         }
/*      */       }
/*      */     } catch (RuntimeException e) {
/*  343 */       throw e;
/*      */     } catch (Exception e) {
View Full Code Here

/*  999 */         state.loader = loader;
/* 1000 */         state.receiver = this;
/* 1001 */         return;
/*      */       }
/*      */
/* 1006 */       JaxBeanInfo beanInfo = XsiTypeLoader.parseXsiType(state, ea, null);
/* 1007 */       if (beanInfo == null)
/*      */       {
/* 1009 */         reportUnexpectedChildElement(ea, false);
/* 1010 */         return;
/*      */       }
/*      */
/* 1013 */       state.loader = beanInfo.getLoader(null, false);
/* 1014 */       state.prev.backup = new JAXBElement(ea.createQName(), Object.class, null);
/* 1015 */       state.receiver = this;
/*      */     }
View Full Code Here

/*  62 */     super(true);
/*  63 */     this.defaultBeanInfo = defaultBeanInfo;
/*     */   }
/*     */
/*     */   public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
/*  67 */     JaxBeanInfo beanInfo = parseXsiType(state, ea, this.defaultBeanInfo);
/*  68 */     if (beanInfo == null) {
/*  69 */       beanInfo = this.defaultBeanInfo;
/*     */     }
/*  71 */     Loader loader = beanInfo.getLoader(null, false);
/*  72 */     state.loader = loader;
/*  73 */     loader.startElement(state, ea);
/*     */   }
View Full Code Here

/*  73 */     loader.startElement(state, ea);
/*     */   }
/*     */
/*     */   static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
/*  77 */     UnmarshallingContext context = state.getContext();
/*  78 */     JaxBeanInfo beanInfo = null;
/*     */
/*  81 */     Attributes atts = ea.atts;
/*  82 */     int idx = atts.getIndex("http://www.w3.org/2001/XMLSchema-instance", "type");
/*     */
/*  84 */     if (idx >= 0)
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.