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

Examples of com.sun.xml.bind.v2.model.runtime.RuntimeElementInfo


    }

    public void testReflection() throws Exception {
        MyBean bean = new MyBean();
        RuntimeTypeInfoSet model = create(MyBean.class);
        RuntimeClassInfo clsInfo = (RuntimeClassInfo)model.getTypeInfo(MyBean.class);
        for (RuntimePropertyInfo p : clsInfo.getProperties()) {
            // System.out.print(p.getName());
            // System.out.println(" " + p.isCollection());
            if (p.getName().equals("notes")) {
                Collection c = (Collection)p.getAccessor().get(bean);
                c.add("123");
View Full Code Here


        for( RuntimeElementInfo n : typeSet.getAllElements() ) {
            ElementBeanInfoImpl bi = getOrCreate(n);
            if(n.getScope()==null)
                rootMap.put(n.getElementName(),bi);

            RuntimeClassInfo scope = n.getScope();
            Class scopeClazz = scope==null?null:scope.getClazz();
            Map<QName,ElementBeanInfoImpl> m = elements.get(scopeClazz);
            if(m==null) {
                m = new LinkedHashMap<QName, ElementBeanInfoImpl>();
                elements.put(scopeClazz,m);
            }
View Full Code Here

        tb._catch((JClass) rootReader.getCodeModel()._ref(DatatypeConfigurationException.class));
       
        Map<QName, ? extends RuntimeElementInfo> elementMappings = set.getElementMappings(null);
        for (Map.Entry<QName, ? extends RuntimeElementInfo> e : elementMappings.entrySet()) {
            QName q = e.getKey();
            RuntimeElementInfo rei = e.getValue();
           
            if (!ref2Parser.containsKey(rei)) {
                createRefParser(rootReader, q, rei);
            }
        }       
View Full Code Here

            } else if (prop instanceof RuntimeReferencePropertyInfo) {
               
                // Handle a reference to an <element> or choice of elements
                RuntimeReferencePropertyInfo propRef = (RuntimeReferencePropertyInfo) prop;
                for (RuntimeElement re : propRef.getElements()) {
                    RuntimeElementInfo rei = (RuntimeElementInfo) re;
                  
                    ElementParserBuilder elBuilder = classBuilder.expectElement(rei.getElementName());
                    JVar beanVar2 = elBuilder.passParentVariable(beanVar);
                   
                    ElementParserBuilder objBuilder = ref2Parser.get(rei);
                    if (objBuilder == null) {
                        createRefParser(rootReader, rei.getElementName(), rei);
                        objBuilder = ref2Parser.get(rei);
                    }
                   
                    JVar retVar = elBuilder.call(model._ref(rei.getType()), "_ret", objBuilder);
                    elBuilder.getBody()._return(retVar);
                    doSet(elBuilder.getBody().getBlock(), beanVar2, beanClass, propRef, retVar);

                }
            } else if (prop instanceof RuntimeValuePropertyInfo) {
View Full Code Here

        }

        Map<QName, ? extends RuntimeElementInfo> elementMappings = set.getElementMappings(null);
        for (Map.Entry<QName, ? extends RuntimeElementInfo> e : elementMappings.entrySet()) {
            QName q = e.getKey();
            RuntimeElementInfo rei = e.getValue();
            Class<?> c = (Class<?>) rei.getContentType().getType();
            JType jt = model._ref(c);
           
            ElementWriterBuilder instcWriter =
                rootWriter.newCondition(rootWriter.getObject()._instanceof(jt), jt);
            if (rei.getContentType().isSimpleType()) {
              writeSimpleTypeElement(instcWriter, rei.getContentType(), null, true, c, c, jt);
            } else {
              add(rootWriter, c, (RuntimeClassInfo) rei.getContentType());
            }
           
            c2type.put(c, q);
        }
       
View Full Code Here

            } else if (prop instanceof RuntimeReferencePropertyInfo) {
               
                // Handle a reference to an <element> or choice of elements
                RuntimeReferencePropertyInfo propRef = (RuntimeReferencePropertyInfo) prop;
                for (RuntimeElement re : propRef.getElements()) {
                    RuntimeElementInfo rei = (RuntimeElementInfo) re;
                  
                    ElementParserBuilder elBuilder = classBuilder.expectElement(rei.getElementName());
                    JVar beanVar2 = elBuilder.passParentVariable(beanVar);
                   
                    ElementParserBuilder objBuilder = ref2Parser.get(rei);
                    if (objBuilder == null) {
                        createRefParser(rootReader, rei.getElementName(), rei);
                        objBuilder = ref2Parser.get(rei);
                    }
                   
                    JVar retVar = elBuilder.call(model._ref(rei.getType()), "_ret", objBuilder);
                    elBuilder.getBody()._return(retVar);
                    doSet(elBuilder.getBody().getBlock(), beanVar2, beanClass, propRef, retVar);

                }
            } else if (prop instanceof RuntimeValuePropertyInfo) {
View Full Code Here

        tb._catch((JClass) rootReader.getCodeModel()._ref(DatatypeConfigurationException.class));
       
        Map<QName, ? extends RuntimeElementInfo> elementMappings = set.getElementMappings(null);
        for (Map.Entry<QName, ? extends RuntimeElementInfo> e : elementMappings.entrySet()) {
            QName q = e.getKey();
            RuntimeElementInfo rei = e.getValue();
           
            if (!ref2Parser.containsKey(rei)) {
                createRefParser(rootReader, q, rei);
            }
        }       
View Full Code Here

            RuntimeReferencePropertyInfo referenceProperty = (RuntimeReferencePropertyInfo) runtimePropertyInfo;
            property.setXmlStyle(Property.XmlStyle.ELEMENT_REF);
            for (RuntimeElement re : referenceProperty.getElements()) {
                ElementMapping elementMapping;
                if (re instanceof RuntimeElementInfo) {
                    RuntimeElementInfo runtimeElement = (RuntimeElementInfo) re;
                    elementMapping = createXmlMapping(property, runtimeElement);
                } else {
                    RuntimeClassInfo runtimeClassInfo = (RuntimeClassInfo) re;
                    elementMapping = createXmlMapping(property, runtimeClassInfo);
                }
View Full Code Here

        return (cp == null) ? null : cp.getInfo();
    }

    @Override
    public boolean isArrayCollection() {
        RuntimePropertyInfo runtimePropertyInfo = isReader ? null : getCurrentElementRuntimePropertyInfo();

        if (runtimePropertyInfo == null && !processedNodes.isEmpty()) {
            final NodeWrapper peek = processedNodes.getLast();
            runtimePropertyInfo = peek.runtimePropertyInfo;
        }

        return runtimePropertyInfo != null && runtimePropertyInfo.isCollection() && !isWildcardElement(runtimePropertyInfo);
    }
View Full Code Here

    @Override
    public boolean hasSubElements() {
        if (isReader) {
            return !getExpectedElements().isEmpty();
        } else {
            final RuntimePropertyInfo rpi = getCurrentElementRuntimePropertyInfo();
            return !processedNodes.isEmpty() && (rpi == null || (rpi.elementOnlyContent()));
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.v2.model.runtime.RuntimeElementInfo

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.