public static Marshaller decorateMarshaller(Class type, Annotation[] annotations, MediaType mediaType, Marshaller marshaller) throws JAXBException { DecoratorMatcher processor = new DecoratorMatcher(); return processor.decorate(Marshaller.class, marshaller, type, annotations, mediaType); }
private <T> void registerDecorators(Class<T> targetClass, HashMap<Class<?>, Annotation> meta, Annotation[] annotations) { for (Annotation annotation : annotations) { Decorators decorators = annotation.annotationType().getAnnotation(Decorators.class); if (decorators != null) { for (Decorator decorator : decorators.values()) { putMeta(targetClass, meta, annotation, decorator); } } else { Decorator decorator = annotation.annotationType().getAnnotation(Decorator.class); putMeta(targetClass, meta, annotation, decorator); } } }
if (type != null) registerDecorators(targetClass, meta, type.getAnnotations()); registerDecorators(targetClass, meta, annotations); if (decorators != null) { for (Decorator decorator : decorators.values()) { injectDecorator(typeMap, decoratorAnnotation, decorator); injectDecorator(typeMap, decoratorAnnotation, decorator); for (Decorator decorator : decorators.values()) { if (decorator.target().isAssignableFrom(target.getClass())) { target = doDecoration(target, type, annotations, mediaType, annotation, decorator); target = doDecoration(target, type, annotations, mediaType, annotation, decorator);
if (decoratorMatcher.hasDecorator(DecoratedEntityContainer.class, annotations)) { decoratorMatcher.decorate(DecoratedEntityContainer.class, new DecoratedEntityContainer(value), type, annotations, mediaType);
if (type != null) registerDecorators(targetClass, meta, type.getAnnotations()); registerDecorators(targetClass, meta, annotations); if (decorators != null) { for (Decorator decorator : decorators.values()) { injectDecorator(typeMap, decoratorAnnotation, decorator); injectDecorator(typeMap, decoratorAnnotation, decorator); for (Decorator decorator : decorators.values()) { if (decorator.target().isAssignableFrom(target.getClass())) { target = doDecoration(target, type, annotations, mediaType, annotation, decorator); target = doDecoration(target, type, annotations, mediaType, annotation, decorator);
public static Unmarshaller decorateUnmarshaller(Class type, Annotation[] annotations, MediaType mediaType, Unmarshaller marshaller) throws JAXBException { DecoratorMatcher processor = new DecoratorMatcher(); return processor.decorate(Unmarshaller.class, marshaller, type, annotations, mediaType); }
private <T> void registerDecorators(Class<T> targetClass, HashMap<Class<?>, Annotation> meta, Annotation[] annotations) { for (Annotation annotation : annotations) { Decorators decorators = annotation.annotationType().getAnnotation(Decorators.class); if (decorators != null) { for (Decorator decorator : decorators.values()) { putMeta(targetClass, meta, annotation, decorator); } } else { Decorator decorator = annotation.annotationType().getAnnotation(Decorator.class); putMeta(targetClass, meta, annotation, decorator); } } }