Package org.jboss.resteasy.annotations

Examples of org.jboss.resteasy.annotations.Decorator


      // override any class level ones
      if (annotations != null)
      {
         for (Annotation annotation : annotations)
         {
            Decorator decorator = annotation.annotationType().getAnnotation(Decorator.class);
            if (decorator != null && targetClass.isAssignableFrom(decorator.target()))
            {
               meta.put(annotation.annotationType(), annotation);
            }
         }
      }
      if (meta.size() == 0) return target;

      MediaTypeMap<Class<?>> typeMap = new MediaTypeMap<Class<?>>();
      for (Class<?> decoratorAnnotation : meta.keySet())
      {
         Decorator decorator = decoratorAnnotation.getAnnotation(Decorator.class);
         String[] mediaTypes = {"*/*"};
         DecorateTypes produces = decorator.processor().getAnnotation(DecorateTypes.class);
         if (produces != null)
         {
            mediaTypes = produces.value();
         }
         for (String pType : mediaTypes)
         {
            typeMap.add(MediaType.valueOf(pType), decoratorAnnotation);
         }
      }

      List<Class<?>> list = typeMap.getPossible(mediaType);
      for (Class<?> decoratorAnnotation : list)
      {
         Annotation annotation = meta.get(decoratorAnnotation);
         Decorator decorator = decoratorAnnotation.getAnnotation(Decorator.class);
         DecoratorProcessor processor = null;
         try
         {
            processor = decorator.processor().newInstance();
         }
         catch (InstantiationException e)
         {
            throw new RuntimeException(e.getCause());
         }
View Full Code Here


      if (meta.size() == 0) return target;

      MediaTypeMap<Class<?>> typeMap = new MediaTypeMap<Class<?>>();
      for (Class<?> decoratorAnnotation : meta.keySet())
      {
         Decorator decorator = decoratorAnnotation.getAnnotation(Decorator.class);
         String[] mediaTypes = {"*/*"};
         DecorateTypes produces = decorator.processor().getAnnotation(DecorateTypes.class);
         if (produces != null)
         {
            mediaTypes = produces.value();
         }
         for (String pType : mediaTypes)
         {
            typeMap.add(MediaType.valueOf(pType), decoratorAnnotation);
         }
      }

      List<Class<?>> list = typeMap.getPossible(mediaType);
      for (Class<?> decoratorAnnotation : list)
      {
         Annotation annotation = meta.get(decoratorAnnotation);
         Decorator decorator = decoratorAnnotation.getAnnotation(Decorator.class);
         DecoratorProcessor processor = null;
         try
         {
            processor = decorator.processor().newInstance();
         }
         catch (InstantiationException e)
         {
            throw new RuntimeException(e.getCause());
         }
View Full Code Here

   }

  private <T> void registerDecorators(Class<T> targetClass, HashMap<Class<?>, Annotation> meta, Annotation[] annotations) {
     for (Annotation annotation : annotations)
     {
       Decorator decorator = annotation.annotationType().getAnnotation(Decorator.class);
       if (decorator != null && targetClass.isAssignableFrom(decorator.target()))
       {
         meta.put(annotation.annotationType(), annotation);
       }
     }
  }
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.annotations.Decorator

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.