Package com.sun.xml.bind.v2.schemagen

Examples of com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace


    public void serializeAttributes(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
        for( AttributeProperty<BeanT> p : attributeProperties )
            try {
                if (retainPropertyInfo) {
                final Property parentProperty = target.getCurrentProperty();
                target.currentProperty.set(p);
                p.serializeAttributes(bean,target);
                target.currentProperty.set(parentProperty);
                } else {
                    p.serializeAttributes(bean,target);
View Full Code Here


    }

    public void serializeURIs(BeanT bean, XMLSerializer target) throws SAXException {
        try {
            if (retainPropertyInfo) {
            final Property parentProperty = target.getCurrentProperty();
            for( Property<BeanT> p : uriProperties ) {
                target.currentProperty.set(p);
                p.serializeURIs(bean,target);
            }
            target.currentProperty.set(parentProperty);
View Full Code Here

        if(!(bi instanceof ClassBeanInfoImpl))
            throw new JAXBException(wrapperBean+" is not a bean");

        for( ClassBeanInfoImpl cb = (ClassBeanInfoImpl) bi; cb!=null; cb=cb.superClazz) {
            for (Property p : cb.properties) {
                final Accessor acc = p.getElementPropertyAccessor(nsUri,localName);
                if(acc!=null)
                    return new RawAccessor() {
                        // Accessor.set/get are designed for unmarshaller/marshaller, and hence
                        // they go through an adapter behind the scene.
                        // this isn't desirable for JAX-WS, which essentially uses this method
                        // just as a reflection library. So use the "unadapted" version to
                        // achieve the desired semantics
                        public Object get(Object bean) throws AccessorException {
                            return acc.getUnadapted(bean);
                        }

                        public void set(Object bean, Object value) throws AccessorException {
                            acc.setUnadapted(bean,value);
                        }
                    };
            }
        }
        throw new JAXBException(new QName(nsUri,localName)+" is not a valid property on "+wrapperBean);
View Full Code Here

    }

    public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) {
        keyLoader = keyBeanInfo.getLoader(chain.context,true);
        valueLoader = valueBeanInfo.getLoader(chain.context,true);
        handlers.put(tagName,new ChildLoader(itemsLoader,null));
    }
View Full Code Here

    public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) {
        if(loader==null) {
            // these variables have to be set before they are initialized,
            // because the initialization may build other loaders and they may refer to this.
            StructureLoader sl = new StructureLoader(this);
            loader = sl;
            if(ci.hasSubClasses())
                loaderWithTypeSubst = new XsiTypeLoader(this);
            else
                // optimization. we know there can be no @xsi:type
                loaderWithTypeSubst = loader;


            sl.init(context,this,ci.getAttributeWildcard());
        }
        if(typeSubstitutionCapable)
            return loaderWithTypeSubst;
        else
            return loader;
View Full Code Here

    public MarshallerImpl createMarshaller() {
        return new MarshallerImpl(this,null);
    }

    public UnmarshallerImpl createUnmarshaller() {
        return new UnmarshallerImpl(this,null);
    }   
View Full Code Here

/*     */     }
/*     */     catch (IllegalAnnotationsException e) {
/* 814 */       throw new AssertionError(e);
/*     */     }
/*     */
/* 817 */     XmlSchemaGenerator xsdgen = new XmlSchemaGenerator(tis.getNavigator(), tis);
/*     */
/* 823 */     Set rootTagNames = new HashSet();
/* 824 */     for (RuntimeElementInfo ei : tis.getAllElements()) {
/* 825 */       rootTagNames.add(ei.getElementName());
/*     */     }
/* 827 */     for (RuntimeClassInfo ci : tis.beans().values()) {
/* 828 */       if (ci.isElement()) {
/* 829 */         rootTagNames.add(ci.asElement().getElementName());
/*     */       }
/*     */     }
/* 832 */     for (TypeReference tr : this.bridges.keySet()) {
/* 833 */       if (rootTagNames.contains(tr.tagName)) {
/*     */         continue;
/*     */       }
/* 836 */       if ((tr.type == Void.TYPE) || (tr.type == Void.class)) {
/* 837 */         xsdgen.add(tr.tagName, false, null);
/*     */       }
/* 839 */       else if (tr.type != CompositeStructure.class)
/*     */       {
/* 842 */         NonElement typeInfo = getXmlType(tis, tr);
/* 843 */         xsdgen.add(tr.tagName, !Navigator.REFLECTION.isPrimitive(tr.type), typeInfo);
/*     */       }
/*     */     }
/* 846 */     return xsdgen;
/*     */   }
View Full Code Here

 
  @Test
  public void testOutputElementNamespaces() {
    String txt = "<ns:root xmlns:ns=\"myns\" xmlns:ans=\"attributens\" xmlns:two=\"two\" ans:att=\"val\"/>";
    Element emt = new Element("root", Namespace.getNamespace("ns", "myns"));
    Namespace ans = Namespace.getNamespace("ans", "attributens");
    emt.setAttribute(new Attribute("att", "val", ans));
    emt.addNamespaceDeclaration(Namespace.getNamespace("two", "two"));
    checkOutput(emt,
        txt, txt,txt, txt, txt);
  }
View Full Code Here

    }
   
    @Test
    public void testOutputDocumentNamespaces() {
    Element emt = new Element("root", Namespace.getNamespace("ns", "myns"));
    Namespace ans = Namespace.getNamespace("ans", "attributens");
    emt.addNamespaceDeclaration(ans);
    emt.addNamespaceDeclaration(Namespace.getNamespace("two", "two"));
    emt.setAttribute(new Attribute("att", "val", ans));
    emt.addContent(new Element("child", Namespace.getNamespace("", "childuri")));
    Document doc = new Document(emt);
View Full Code Here

    }
   
    @Test
    public void testRTOutputElementNamespaces() {
    Element emt = new Element("root", Namespace.getNamespace("ns", "myns"));
    Namespace ans = Namespace.getNamespace("ans", "attributens");
    emt.addNamespaceDeclaration(ans);
    emt.addNamespaceDeclaration(Namespace.getNamespace("two", "two"));
    emt.setAttribute(new Attribute("att", "val", ans));
    emt.addContent(new Element("child", Namespace.getNamespace("", "childns")));
    roundTripElement(emt);
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace

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.