Package javax.xml.bind.annotation

Examples of javax.xml.bind.annotation.XmlRootElement.namespace()


   
    XmlRootElement root = bean.getAnnotation(XmlRootElement.class);
   
    if (root != null) {
      name = root.name();
      namespace = !root.namespace().equals("##default") ? root.namespace() : "";
      rootElement = true;
    } else {
      XmlElement element = bean.getAnnotation(XmlElement.class);
      if (element != null) {
        name = element.name();
View Full Code Here


   
    XmlRootElement root = bean.getAnnotation(XmlRootElement.class);
   
    if (root != null) {
      name = root.name();
      namespace = !root.namespace().equals("##default") ? root.namespace() : "";
      rootElement = true;
    } else {
      XmlElement element = bean.getAnnotation(XmlElement.class);
      if (element != null) {
        name = element.name();
View Full Code Here

        if (!found) {
            //not in object factory or no object factory, try other annotations
            XmlRootElement elAnnot = cls.getAnnotation(XmlRootElement.class);
            if (elAnnot != null) {
                String name = elAnnot.name();
                String ns = elAnnot.namespace();
                if (StringUtils.isEmpty(ns)
                    || "##default".equals(ns)) {
                    XmlSchema schema = null;
                    if (cls.getPackage() != null) {
                        schema = cls.getPackage().getAnnotation(XmlSchema.class);
View Full Code Here

            cls = cls.getComponentType();
            postfix += "Array";
        }
        XmlRootElement xre = cls.getAnnotation(XmlRootElement.class);
        String name = xre == null ? "##default" : xre.name();
        String namespace = xre == null ? "##default" : xre.namespace();
        if ("##default".equals(name)) {
            name = java.beans.Introspector.decapitalize(cls.getSimpleName());
        }
        if ("##default".equals(namespace) && cls.getPackage() != null) {
            XmlSchema sc = cls.getPackage().getAnnotation(XmlSchema.class);
View Full Code Here

     
      assertNotNull(packet);
      assertTrue( packet instanceof OADR2IQ );
      Object payload1 = ((OADR2IQ)packet).getOADRPayload();
      XmlRootElement annotation = payload1.getClass().getAnnotation( XmlRootElement.class );
      assertEquals( OADR2_XMLNS, annotation.namespace() );
      assertEquals( "oadrDistributeEvent", annotation.name() );
        assertTrue( payload1 instanceof OadrDistributeEvent );
     
        OADR2PacketExtension extension = (OADR2PacketExtension)packet.getExtension(OADR2_XMLNS);
      assertEquals("oadrDistributeEvent", extension.getElementName());
View Full Code Here

      namespace = xmlType.namespace();
    } else {
      XmlRootElement xmlRootElement = clazz.getAnnotation(XmlRootElement.class);
      if (xmlRootElement != null) {
        elementName = xmlRootElement.name();
        namespace = xmlRootElement.namespace();
      }
    }

    if ("##default".equals(elementName)) {
      elementName = StringUtils.uncapitalize(clazz.getSimpleName());
View Full Code Here

            String typeName = type.name();

            if (typeNamespace.equals("##default") && typeName.equals("")) {
                XmlRootElement rootElement = javaType.getAnnotation(XmlRootElement.class);
                if (rootElement != null) {
                    namespace = rootElement.namespace();
                } else {
                    // FIXME: The namespace should be from the referencing
                    // property
                    namespace = null;
                }
View Full Code Here

   
    private QName getJaxbQName(JAXBContextProxy jaxbProxy, Class<?> type, Map<Class<?>, QName> clsMap) {
       
        XmlRootElement root = type.getAnnotation(XmlRootElement.class);
        if (root != null) {
            QName qname = getQNameFromParts(root.name(), root.namespace(), clsMap);
            if (qname != null) {
                return qname;
            }
            String ns = JAXBUtils.getPackageNamespace(type);
            if (ns != null) {
View Full Code Here

            return object != null ? ((JAXBElement)object).getName() : null;
        }
       
        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

    private void processXmlRootElement(JavaClass javaClass, TypeInfo info) {
        if (helper.isAnnotationPresent(javaClass, XmlRootElement.class)) {
            XmlRootElement rootElemAnnotation = (XmlRootElement) helper.getAnnotation(javaClass, XmlRootElement.class);
            org.eclipse.persistence.jaxb.xmlmodel.XmlRootElement xmlRE = new org.eclipse.persistence.jaxb.xmlmodel.XmlRootElement();
            xmlRE.setName(rootElemAnnotation.name());
            xmlRE.setNamespace(rootElemAnnotation.namespace());
            info.setXmlRootElement(xmlRE);
        }
    }

    /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.