Package javax.xml.bind.annotation

Examples of javax.xml.bind.annotation.XmlType


       
        XmlRootElement root = cls.getAnnotation(XmlRootElement.class);
        if (root != null) {
            return getQNameFromNamespaceAndName(root.namespace(), root.name(), cls, pluralName);
        } else if (cls.getAnnotation(XmlType.class) != null) {
            XmlType xmlType = cls.getAnnotation(XmlType.class);
            return getQNameFromNamespaceAndName(xmlType.namespace(), xmlType.name(), cls, pluralName);
        } else {
            return new QName(getPackageNamespace(cls), cls.getSimpleName());
        }
    }
View Full Code Here


            if (s.getNamespaceURI().equals(part.getElementQName().getNamespaceURI())) {
                schemaInfo = s;
                break;
            }
        }
        XmlType xmlTypeAnno = cls.getAnnotation(XmlType.class);
        boolean respectXmlTypeNS = false;
        XmlSchema faultBeanSchema = null;
        if (xmlTypeAnno != null && !StringUtils.isEmpty(xmlTypeAnno.namespace())
            && !xmlTypeAnno.namespace().equals(part.getElementQName().getNamespaceURI())) {
            respectXmlTypeNS = true;
            NamespaceMap nsMap = new NamespaceMap();
            nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, xmlTypeAnno.namespace());
            nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
           
            SchemaInfo faultBeanSchemaInfo = createSchemaIfNeeded(xmlTypeAnno.namespace(), nsMap);
            faultBeanSchema = faultBeanSchemaInfo.getSchema();           
        }
       
        XmlSchema schema = null;
        if (schemaInfo == null) {
            NamespaceMap nsMap = new NamespaceMap();
            nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, part.getElementQName().getNamespaceURI());
            nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
            schemaInfo = createSchemaIfNeeded(part.getElementQName().getNamespaceURI(), nsMap);

        }
        schema = schemaInfo.getSchema();
      

        // Before updating everything, make sure we haven't added this
        // type yet.  Multiple methods that throw the same exception
        // types will cause duplicates.
        String faultTypeName = xmlTypeAnno != null && !StringUtils.isEmpty(xmlTypeAnno.name())
               ? xmlTypeAnno.name()  :  part.getElementQName().getLocalPart();
        XmlSchemaType existingType = schema.getTypeByName(faultTypeName);
        if (existingType != null) {
            return;
        }
View Full Code Here

       
        XmlRootElement root = cls.getAnnotation(XmlRootElement.class);
        if (root != null) {
            return getQNameFromNamespaceAndName(root.namespace(), root.name(), cls, pluralName);
        } else if (cls.getAnnotation(XmlType.class) != null) {
            XmlType xmlType = cls.getAnnotation(XmlType.class);
            return getQNameFromNamespaceAndName(xmlType.namespace(), xmlType.name(), cls, pluralName);
        } else {
            return new QName(getPackageNamespace(cls), cls.getSimpleName());
        }
    }
View Full Code Here

            if (elementName.equals("##default")) {
                elementName = jaxbDecapitalize(javaType.getSimpleName());
            }
            elementQName = new QName(elementNamespace, elementName);
        }
        XmlType type = javaType.getAnnotation(XmlType.class);
        if (type != null) {
            String typeNamespace = type.namespace();
            String typeName = type.name();

            if (typeNamespace.equals("##default")) {
                // namespace is from the package
                typeNamespace = namespace;
            }
View Full Code Here

            if (s.getNamespaceURI().equals(part.getElementQName().getNamespaceURI())) {
                schemaInfo = s;
                break;
            }
        }
        XmlType xmlTypeAnno = cls.getAnnotation(XmlType.class);
        boolean respectXmlTypeNS = false;
        XmlSchema faultBeanSchema = null;
        if (xmlTypeAnno != null && !StringUtils.isEmpty(xmlTypeAnno.namespace())
            && !xmlTypeAnno.namespace().equals(part.getElementQName().getNamespaceURI())) {
            respectXmlTypeNS = true;
            NamespaceMap nsMap = new NamespaceMap();
            nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, xmlTypeAnno.namespace());
            nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
           
            SchemaInfo faultBeanSchemaInfo = createSchemaIfNeeded(xmlTypeAnno.namespace(), nsMap);
            faultBeanSchema = faultBeanSchemaInfo.getSchema();           
        }
       
        XmlSchema schema = null;
        if (schemaInfo == null) {
            NamespaceMap nsMap = new NamespaceMap();
            nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, part.getElementQName().getNamespaceURI());
            nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
            schemaInfo = createSchemaIfNeeded(part.getElementQName().getNamespaceURI(), nsMap);

        }
        schema = schemaInfo.getSchema();
      

        // Before updating everything, make sure we haven't added this
        // type yet.  Multiple methods that throw the same exception
        // types will cause duplicates.
        String faultTypeName = xmlTypeAnno != null && !StringUtils.isEmpty(xmlTypeAnno.name())
               ? xmlTypeAnno.name()  :  part.getElementQName().getLocalPart();
        XmlSchemaType existingType = schema.getTypeByName(faultTypeName);
        if (existingType != null) {
            return;
        }
View Full Code Here

            return null;
         }

         public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation)
         {
            XmlType xmlType = rootType.getAnnotation(XmlType.class);
            if(xmlType == null)
            {
               fail("The root type is expected to be annotated with XmlType: " + rootType);
            }
           
            SchemaBinding schema = JBossXBBuilder.build(rootType);
            String typeNs = xmlType.namespace();
            if(typeNs.equals(JBossXmlConstants.DEFAULT))
            {
               typeNs = (String) schema.getNamespaces().iterator().next();
            }
            QName typeName = new QName(typeNs, xmlType.name());
            TypeBinding type = schema.getType(typeName);
            if(type == null)
            {
               fail("Type " + typeName + " not found in the schema!");
            }
View Full Code Here

            if (elementName.equals("##default")) {
                elementName = jaxbDecapitalize(javaType.getSimpleName());
            }
            elementQName = new QName(elementNamespace, elementName);
        }
        XmlType type = javaType.getAnnotation(XmlType.class);
        if (type != null) {
            String typeNamespace = type.namespace();
            String typeName = type.name();

            if (typeNamespace.equals("##default")) {
                // namespace is from the package
                typeNamespace = namespace;
            }
View Full Code Here

     *
     * @param implementation The implementation class, or {@code null} if unknown.
     */
    PropertyComparator(final Class<?> implementation) {
        if (implementation != null) {
            final XmlType xml = implementation.getAnnotation(XmlType.class);
            if (xml != null) {
                order = xml.propOrder();
                return;
            }
        }
        order = null;
    }
View Full Code Here

             */
            assertExpectedNamespace(root.namespace(), impl, uml);
            /*
             * Compare the XmlType annotation with the expected value.
             */
            final XmlType xmlType = impl.getAnnotation(XmlType.class);
            assertNotNull("Missing @XmlType annotation.", xmlType);
            String expected = getExpectedTypeForElement(type, impl);
            if (expected == null) {
                expected = DEFAULT;
            }
            assertEquals("Wrong @XmlType.name().", expected, xmlType.name());
        }
        done();
    }
View Full Code Here

       
        XmlRootElement root = cls.getAnnotation(XmlRootElement.class);
        if (root != null) {
            return getQNameFromNamespaceAndName(root.namespace(), root.name(), cls, pluralName);
        } else if (cls.getAnnotation(XmlType.class) != null) {
            XmlType xmlType = cls.getAnnotation(XmlType.class);
            return getQNameFromNamespaceAndName(xmlType.namespace(), xmlType.name(), cls, pluralName);
        } else {
            return new QName(getPackageNamespace(cls), cls.getSimpleName());
        }
    }
View Full Code Here

TOP

Related Classes of javax.xml.bind.annotation.XmlType

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.