protected AnnotationBasedRendererBeanDescriptor(final Class<R> rendererClass) throws DescriptorException { super(rendererClass, true); final RendererBean rendererBeanAnnotation = ReflectionUtils.getAnnotation(rendererClass, RendererBean.class); if (rendererBeanAnnotation == null) { throw new DescriptorException(rendererClass + " doesn't implement the RendererBean annotation"); } _renderingFormat = rendererBeanAnnotation.value(); if (_renderingFormat == null || _renderingFormat.isInterface() || Modifier .isAbstract(_renderingFormat.getModifiers())) { throw new DescriptorException("Rendering format (" + _renderingFormat + ") is not a non-abstract class"); } _formatOutputType = ReflectionUtils.getTypeParameter(_renderingFormat, RenderingFormat.class, 0); logger.debug("Found format output type: {}", _formatOutputType); if (_formatOutputType == null) { throw new DescriptorException("Could not determine output type of rendering format: " + _renderingFormat); } @SuppressWarnings("unchecked") final Class<? extends Renderable> rendererInputType = (Class<? extends Renderable>) ReflectionUtils.getTypeParameter(rendererClass, Renderer.class, 0); _rendererInputType = rendererInputType; logger.debug("Found renderer input type: {}", _rendererInputType); _rendererOutputType = ReflectionUtils.getTypeParameter(rendererClass, Renderer.class, 1); logger.debug("Found renderer output type: {}", _rendererOutputType); if (_rendererOutputType == null) { throw new DescriptorException("Could not determine output type of renderer: " + rendererClass); } if (!ReflectionUtils.is(_rendererOutputType, _formatOutputType)) { throw new DescriptorException("The renderer output type (" + _rendererOutputType + ") is not a valid instance or sub-class of format output type (" + _formatOutputType + ")"); } }