Package javax.xml.bind.annotation

Examples of javax.xml.bind.annotation.XmlElementDecl


                            defaultValue = xmlEltDecl.getDefaultValue();
                        }
                    } else {
                        // there was no xml-element-decl for this method in XML,
                        // so use the annotation
                        XmlElementDecl elementDecl = (XmlElementDecl) helper.getAnnotation(next, XmlElementDecl.class);
                        url = elementDecl.namespace();
                        localName = elementDecl.name();
                        scopeClass = elementDecl.scope();
                        if (!elementDecl.substitutionHeadName().equals(EMPTY_STRING)) {
                            String subHeadLocal = elementDecl.substitutionHeadName();
                            String subHeadNamespace = elementDecl.substitutionHeadNamespace();
                            if (subHeadNamespace.equals(XMLProcessor.DEFAULT)) {
                                subHeadNamespace = packageInfo.getNamespace();
                            }

                            substitutionHead = new QName(subHeadNamespace, subHeadLocal);
                        }
                        if (!(elementDecl.defaultValue().length() == 1 && elementDecl.defaultValue().startsWith(ELEMENT_DECL_DEFAULT))) {
                            defaultValue = elementDecl.defaultValue();
                        }
                    }
                   
                    if (XMLProcessor.DEFAULT.equals(url)) {
                        url = packageInfo.getNamespace();
View Full Code Here


                    defaultValue = xmlEltDecl.getDefaultValue();
                }
            } else {
                // there was no xml-element-decl for this method in XML,
                // so use the annotation
                XmlElementDecl elementDecl = (XmlElementDecl) helper.getAnnotation(next, XmlElementDecl.class);
                url = elementDecl.namespace();
                localName = elementDecl.name();
                scopeClass = elementDecl.scope();
                if (!elementDecl.substitutionHeadName().equals(EMPTY_STRING)) {
                    String subHeadLocal = elementDecl.substitutionHeadName();
                    String subHeadNamespace = elementDecl.substitutionHeadNamespace();
                    if (subHeadNamespace.equals(XMLProcessor.DEFAULT)) {
                        subHeadNamespace = packageInfo.getNamespace();
                    }

                    substitutionHead = new QName(subHeadNamespace, subHeadLocal);
                }
                if (!(elementDecl.defaultValue().length() == 1 && elementDecl.defaultValue().startsWith(ELEMENT_DECL_DEFAULT))) {
                    defaultValue = elementDecl.defaultValue();
                }
            }
           
            if (XMLProcessor.DEFAULT.equals(url)) {
                url = packageInfo.getNamespace();
View Full Code Here

                            defaultValue = xmlEltDecl.getDefaultValue();
                        }
                    } else {
                        // there was no xml-element-decl for this method in XML,
                        // so use the annotation
                        XmlElementDecl elementDecl = (XmlElementDecl) helper.getAnnotation(next, XmlElementDecl.class);
                        url = elementDecl.namespace();
                        localName = elementDecl.name();
                        scopeClass = elementDecl.scope();
                        if (!elementDecl.substitutionHeadName().equals(EMPTY_STRING)) {
                            String subHeadLocal = elementDecl.substitutionHeadName();
                            String subHeadNamespace = elementDecl.substitutionHeadNamespace();
                            if (subHeadNamespace.equals(XMLProcessor.DEFAULT)) {
                                subHeadNamespace = packageInfo.getNamespace();
                            }

                            substitutionHead = new QName(subHeadNamespace, subHeadLocal);
                        }
                        if (!(elementDecl.defaultValue().length() == 1 && elementDecl.defaultValue().startsWith(ELEMENT_DECL_DEFAULT))) {
                            defaultValue = elementDecl.defaultValue();
                        }
                    }
                   
                    if (XMLProcessor.DEFAULT.equals(url)) {
                        url = packageInfo.getNamespace();
View Full Code Here

                            defaultValue = xmlEltDecl.getDefaultValue();
                        }
                    } else {
                        // there was no xml-element-decl for this method in XML,
                        // so use the annotation
                        XmlElementDecl elementDecl = (XmlElementDecl) helper.getAnnotation(next, XmlElementDecl.class);
                        url = elementDecl.namespace();
                        localName = elementDecl.name();
                        scopeClass = elementDecl.scope();
                        if (!elementDecl.substitutionHeadName().equals(EMPTY_STRING)) {
                            String subHeadLocal = elementDecl.substitutionHeadName();
                            String subHeadNamespace = elementDecl.substitutionHeadNamespace();
                            if (subHeadNamespace.equals(XMLProcessor.DEFAULT)) {
                                subHeadNamespace = packageInfo.getNamespace();
                            }

                            substitutionHead = new QName(subHeadNamespace, subHeadLocal);
                        }
                        if (!(elementDecl.defaultValue().length() == 1 && elementDecl.defaultValue().startsWith(ELEMENT_DECL_DEFAULT))) {
                            defaultValue = elementDecl.defaultValue();
                        }
                    }

                    if (XMLProcessor.DEFAULT.equals(url)) {
                        url = packageInfo.getNamespace();
View Full Code Here

            // looking at members will only add more errors, so just abort now
            return;
        }

        for( M m : nav.getDeclaredMethods(registryClass) ) {
            XmlElementDecl em = builder.reader.getMethodAnnotation(
                XmlElementDecl.class, m, this );

            if(em==null) {
                if(nav.getMethodName(m).startsWith("create")) {
                    // this is a factory method. visit this class
View Full Code Here

        return cachedContextAndSchemas;
    }
   
    private static boolean checkObjectFactoryNamespaces(Class<?> clz) {
        for (Method meth : clz.getMethods()) {
            XmlElementDecl decl = meth.getAnnotation(XmlElementDecl.class);
            if (decl != null
                && XmlElementDecl.GLOBAL.class.equals(decl.scope())
                && StringUtils.isEmpty(decl.namespace())) {
                return true;
            }
        }

        return false;
View Full Code Here

        return cachedContextAndSchemas;
    }
   
    private static boolean checkObjectFactoryNamespaces(Class<?> clz) {
        for (Method meth : clz.getMethods()) {
            XmlElementDecl decl = meth.getAnnotation(XmlElementDecl.class);
            if (decl != null
                && XmlElementDecl.GLOBAL.class.equals(decl.scope())
                && StringUtils.isEmpty(decl.namespace())) {
                return true;
            }
        }

        return false;
View Full Code Here

  protected QName getXmlTypeName(Class<?> type) {
    Method method = getXmlElementDeclMethod(type);
    if (method == null) {
      return null;
    }
    XmlElementDecl xmlElementDecl = method.getAnnotation(XmlElementDecl.class);
    if (xmlElementDecl == null) {
      return null;
    }
    XmlSchema xmlSchema = type.getPackage().getAnnotation(XmlSchema.class);
    String namespaceURI = getNamespaceURI(xmlElementDecl, xmlSchema);
    return new QName(namespaceURI, xmlElementDecl.name(), getPrefix(namespaceURI, xmlSchema));
  }
View Full Code Here

      return null;
    }
    XmlSchema xmlSchema = type.getPackage().getAnnotation(XmlSchema.class);
    String namespaceURI = getNamespaceURI(xmlType, xmlSchema);
    for (Method method : factoryClass.getDeclaredMethods()) {
      XmlElementDecl xmlElementDecl = method.getAnnotation(XmlElementDecl.class);
      if (xmlElementDecl != null && namespaceURI.equals(getNamespaceURI(xmlElementDecl, xmlSchema))) {
        if (method.getReturnType() == JAXBElement.class) {
          Class<?>[] parameterTypes = method.getParameterTypes();
          if (parameterTypes.length == 1 && parameterTypes[0] == type) {
            return method;
View Full Code Here

        return new CachedContextAndSchemas(context, classes, cachedContextAndSchemasInternal);
    }
   
    private static boolean checkObjectFactoryNamespaces(Class<?> clz) {
        for (Method meth : clz.getMethods()) {
            XmlElementDecl decl = meth.getAnnotation(XmlElementDecl.class);
            if (decl != null
                && XmlElementDecl.GLOBAL.class.equals(decl.scope())
                && StringUtils.isEmpty(decl.namespace())) {
                return true;
            }
        }

        return false;
View Full Code Here

TOP

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

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.