Package javax.xml.bind.annotation

Examples of javax.xml.bind.annotation.XmlMimeType


            }

            // Scan for XOP field annotations
            else if(field.isAnnotationPresent(XmlMimeType.class))
            {
               XmlMimeType mimeTypeDecl = field.getAnnotation(XmlMimeType.class);
               result = new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP);
            }

            if(null == result) // try getter methods
            {
               result = scanGetterAnnotation(xmlRoot, field);
View Full Code Here


         {
            result = new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF);
         }
         else if (method.isAnnotationPresent(XmlMimeType.class))
         {
            XmlMimeType mimeTypeDecl = method.getAnnotation(XmlMimeType.class);
            result = new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP);
         }

         if(result!=null)
         {
            result.setIndex(-1); // default for return values
            results.add(result);
         }

      }

      // method parameter
      int index = 0;
      for (Annotation[] parameterAnnotations : method.getParameterAnnotations())
      {
         if (parameterAnnotations!=null)
         {
            for (Annotation annotation : parameterAnnotations)
            {
               AttachmentScanResult paramResult = null;

               if(XmlAttachmentRef.class == annotation.annotationType())
               {
                  paramResult = new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF);
               }
               else if(XmlMimeType.class == annotation.annotationType())
               {
                  XmlMimeType mimeTypeDecl = ((XmlMimeType)annotation);
                  paramResult = new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP);
               }

               if(paramResult!=null)
               {
                  paramResult.setIndex(index);                 
View Full Code Here

      {
         if(method.getName().equalsIgnoreCase(getterMethodName))
         {
            if(method.isAnnotationPresent(XmlMimeType.class))
            {
               XmlMimeType mimeTypeDecl = method.getAnnotation(XmlMimeType.class);
               return new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP);
            }
            else if(method.isAnnotationPresent(XmlAttachmentRef.class))
            {
               return new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF);
            }
View Full Code Here

        return null;
    }
   
    static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                        ModelBuilder builder ) {
        XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
        if(xmt==null)
            return null;
       
        try {
            return new MimeType(xmt.value());
        } catch (MimeTypeParseException e) {
            builder.reportError(new IllegalAnnotationException(
                Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
                xmt
            ));
            return null;
        }
    }
View Full Code Here

        return null;
    }
   
    static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                        ModelBuilder builder ) {
        XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
        if(xmt==null)
            return null;
       
        try {
            return new MimeType(xmt.value());
        } catch (MimeTypeParseException e) {
            builder.reportError(new IllegalAnnotationException(
                Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
                xmt
            ));
            return null;
        }
    }
View Full Code Here

                        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;
                                        if (!this.hasSwaRef) {
                                            this.hasSwaRef = true;
                                        }
View Full Code Here

                declaration.setJavaType(helper.getJavaClass(declJavaType));
                declaration.setAdaptedJavaType(type);
            }
            if (helper.isAnnotationPresent(next, XmlMimeType.class)) {
                XmlMimeType mimeType = (XmlMimeType)helper.getAnnotation(next, XmlMimeType.class);
                declaration.setXmlMimeType(mimeType.value());
            }
            if (helper.isAnnotationPresent(next, XmlAttachmentRef.class)) {
                declaration.setXmlAttachmentRef(true);
            }
            HashMap<QName, ElementDeclaration> elements = getElementDeclarationsForScope(scopeClass.getName());
View Full Code Here

        return null;
    }

    static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                        ModelBuilder builder ) {
        XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
        if(xmt==null)
            return null;

        try {
            return new MimeType(xmt.value());
        } catch (MimeTypeParseException e) {
            builder.reportError(new IllegalAnnotationException(
                Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
                xmt
            ));
            return null;
        }
    }
View Full Code Here

            }

            // Scan for XOP field annotations
            else if(field.isAnnotationPresent(XmlMimeType.class))
            {
               XmlMimeType mimeTypeDecl = field.getAnnotation(XmlMimeType.class);
               result = new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP);
            }

            if(null == result) // try getter methods
            {
               result = scanGetterAnnotation(xmlRoot, field);
View Full Code Here

         {
            result = new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF);
         }
         else if (method.isAnnotationPresent(XmlMimeType.class))
         {
            XmlMimeType mimeTypeDecl = method.getAnnotation(XmlMimeType.class);
            result = new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP);
         }

         if(result!=null)
         {
            result.setIndex(-1); // default for return values
            results.add(result);
         }

      }

      // method parameter
      int index = 0;
      for (Annotation[] parameterAnnotations : method.getParameterAnnotations())
      {
         if (parameterAnnotations!=null)
         {
            for (Annotation annotation : parameterAnnotations)
            {
               AttachmentScanResult paramResult = null;

               if(XmlAttachmentRef.class == annotation.annotationType())
               {
                  paramResult = new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF);
               }
               else if(XmlMimeType.class == annotation.annotationType())
               {
                  XmlMimeType mimeTypeDecl = ((XmlMimeType)annotation);
                  paramResult = new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP);
               }

               if(paramResult!=null)
               {
                  paramResult.setIndex(index);                 
View Full Code Here

TOP

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

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.