Package org.eclipse.persistence.jaxb

Examples of org.eclipse.persistence.jaxb.TypeMappingInfo


        if (additionalGlobalElements != null) {
            ElementDeclaration declaration;
            for(Entry<QName, Type> entry : additionalGlobalElements.entrySet()) {
                QName key = entry.getKey();
                Type type = entry.getValue();
                TypeMappingInfo tmi = null;
                if(this.typeToTypeMappingInfo != null) {
                    tmi = this.typeToTypeMappingInfo.get(type);
                }

                if(tmi != null) {
View Full Code Here


    public JaxbClassLoader(ClassLoader nestedClassLoader, TypeMappingInfo[] types) {
      super(nestedClassLoader);
        this.generatedClasses = new HashMap();
        if(types != null){
            for(int i=0; i<types.length; i++){
                TypeMappingInfo tmi = types[i];
                Type nextType = tmi.getType();
                if(nextType == null){
                    throw org.eclipse.persistence.exceptions.JAXBException.nullTypeOnTypeMappingInfo(tmi.getXmlTagName());
                }
                if (nextType instanceof Class) {
                    generatedClasses.put(((Class)nextType).getName(), nextType);
                }
            }
View Full Code Here

     */
    public JavaModelInputImpl(Type[] types, JavaModel javaModel) {
         jModel = javaModel;
         jClasses = new JavaClass[types.length];
         for (int i=0; i<types.length; i++) {
             TypeMappingInfo typeMappingInfo = new TypeMappingInfo();
             Type type = types[i];
             typeMappingInfo.setType(type);

             jClasses[i] = buildJavaClassImpl(type);
         }
    }
View Full Code Here

    public JavaModelInputImpl(TypeMappingInfo[] types, JavaModel javaModel) {
        jModel = javaModel;
        jClasses = new JavaClass[types.length];
        for (int i=0; i<types.length; i++) {
            TypeMappingInfo typeMappingInfo = types[i];
            Type type = typeMappingInfo.getType();

            jClasses[i] = buildJavaClassImpl(type);
        }
   }
View Full Code Here

        if (additionalGlobalElements != null) {
            ElementDeclaration declaration;
            for(Entry<QName, Type> entry : additionalGlobalElements.entrySet()) {
                QName key = entry.getKey();
                Type type = entry.getValue();
                TypeMappingInfo tmi = null;
                if(this.typeToTypeMappingInfo != null) {
                    tmi = this.typeToTypeMappingInfo.get(type);
                }

                if(tmi != null) {
View Full Code Here

    static Class getExisitingGeneratedClass(TypeMappingInfo tmi, Map<TypeMappingInfo, Class> typeMappingInfoToGeneratedClasses, Map<TypeMappingInfo, Class> typeMappingInfoToAdapterClasses, ClassLoader loader) {

        Iterator<Map.Entry<TypeMappingInfo, Class>> iter = typeMappingInfoToGeneratedClasses.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry<TypeMappingInfo, Class> next = iter.next();
            TypeMappingInfo nextTMI = next.getKey();
            if (CompilerHelper.generatesSameComplexType(tmi, nextTMI, loader)) {
                return next.getValue();
            }
        }
        return null;
View Full Code Here

     */
    public JavaModelInputImpl(Type[] types, JavaModel javaModel) {
         jModel = javaModel;
         jClasses = new JavaClass[types.length];
         for (int i=0; i<types.length; i++) {
             TypeMappingInfo typeMappingInfo = new TypeMappingInfo();
             Type type = types[i];
             typeMappingInfo.setType(type);

             jClasses[i] = buildJavaClassImpl(type);
         }
    }
View Full Code Here

    public JavaModelInputImpl(TypeMappingInfo[] types, JavaModel javaModel) {
        jModel = javaModel;
        jClasses = new JavaClass[types.length];
        for (int i=0; i<types.length; i++) {
            TypeMappingInfo typeMappingInfo = types[i];
            Type type = typeMappingInfo.getType();

            jClasses[i] = buildJavaClassImpl(type);
        }
   }
View Full Code Here

              if (namespaceUri == null || namespaceUri.equals(XMLProcessor.DEFAULT)) {
                  namespaceUri = "";
              }
        }

        TypeMappingInfo tmi = nextElement.getTypeMappingInfo();
        Class generatedClass = null;

        JaxbClassLoader loader = getJaxbClassLoader();

        if(tmi != null){
View Full Code Here

    public void createElementsForTypeMappingInfo() {
        if (this.javaClassToTypeMappingInfos != null && !this.javaClassToTypeMappingInfos.isEmpty()) {
            Set<JavaClass> classes = this.javaClassToTypeMappingInfos.keySet();
            for (JavaClass nextClass : classes) {
                TypeMappingInfo nextInfo = this.javaClassToTypeMappingInfos.get(nextClass);
                if (nextInfo != null) {
                    boolean xmlAttachmentRef = false;
                    String xmlMimeType = null;
                    java.lang.annotation.Annotation[] annotations = getAnnotations(nextInfo);
                    Class adapterClass = this.typeMappingInfoToAdapterClasses.get(nextInfo);
                    Class declJavaType = null;
                    if (adapterClass != null) {
                        declJavaType = CompilerHelper.getTypeFromAdapterClass(adapterClass);
                    }
                    if (annotations != null) {
                        for (int j = 0; j < annotations.length; j++) {
                            java.lang.annotation.Annotation nextAnnotation = annotations[j];
                            if (nextAnnotation != null) {
                                if (nextAnnotation instanceof XmlMimeType) {
                                    XmlMimeType javaAnnotation = (XmlMimeType) nextAnnotation;
                                    xmlMimeType = javaAnnotation.value();
                                } else if (nextAnnotation instanceof XmlAttachmentRef) {
                                    xmlAttachmentRef = true;
                                }
                            }
                        }
                    }

                    QName qname = null;

                    String nextClassName = nextClass.getQualifiedName();

                    if (declJavaType != null) {
                        nextClassName = declJavaType.getCanonicalName();
                    }

                    if (typeMappingInfoToGeneratedClasses != null) {
                        Class generatedClass = typeMappingInfoToGeneratedClasses.get(nextInfo);
                        if (generatedClass != null) {
                            nextClassName = generatedClass.getCanonicalName();
                        }
                    }

                    TypeInfo nextTypeInfo = typeInfo.get(nextClassName);
                    if (nextTypeInfo != null) {
                        qname = new QName(nextTypeInfo.getClassNamespace(), nextTypeInfo.getSchemaTypeName());
                    } else {
                        qname = getUserDefinedSchemaTypes().get(nextClassName);
                        if (qname == null) {
                            if (nextClassName.equals(ClassConstants.ABYTE.getName()) || nextClassName.equals(ClassConstants.APBYTE.getName()) || nextClassName.equals(Image.class.getName()) || nextClassName.equals(Source.class.getName()) || nextClassName.equals("javax.activation.DataHandler")) {
                                if (xmlAttachmentRef) {
                                    qname = XMLConstants.SWA_REF_QNAME;
                                } else {
                                    qname = XMLConstants.BASE_64_BINARY_QNAME;
                                }
                            } else if (nextClassName.equals(ClassConstants.OBJECT.getName())) {
                                qname = XMLConstants.ANY_TYPE_QNAME;
                            } else if (nextClassName.equals(ClassConstants.XML_GREGORIAN_CALENDAR.getName())) {
                                qname = XMLConstants.ANY_SIMPLE_TYPE_QNAME;
                            } else {
                                Class theClass = helper.getClassForJavaClass(nextClass);
                                qname = (QName) XMLConversionManager.getDefaultJavaTypes().get(theClass);
                            }
                        }
                    }

                    if (qname != null) {
                        typeMappingInfoToSchemaType.put(nextInfo, qname);
                    }

                    if (nextInfo.getXmlTagName() != null) {
                        ElementDeclaration element = new ElementDeclaration(nextInfo.getXmlTagName(), nextClass, nextClass.getQualifiedName(), false);
                        element.setTypeMappingInfo(nextInfo);
                        element.setXmlMimeType(xmlMimeType);
                        element.setXmlAttachmentRef(xmlAttachmentRef);

                        if (declJavaType != null) {
                            element.setJavaType(helper.getJavaClass(declJavaType));
                        }
                        Class generatedClass = typeMappingInfoToGeneratedClasses.get(nextInfo);
                        if (generatedClass != null) {
                            element.setJavaType(helper.getJavaClass(generatedClass));
                        }
                        if (nextInfo.getElementScope() == TypeMappingInfo.ElementScope.Global) {
                            this.getGlobalElements().put(element.getElementName(), element);
                        } else {
                            this.localElements.add(element);
                        }
                    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jaxb.TypeMappingInfo

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.