Package org.springmodules.validation.bean.conf.loader.annotation.handler

Examples of org.springmodules.validation.bean.conf.loader.annotation.handler.ClassValidationAnnotationHandler


     * @param configuration The bean validation configuration to manipulate.
     */
    protected void handleClassAnnotations(Class clazz, MutableBeanValidationConfiguration configuration) {
        Annotation[] annotations = clazz.getAnnotations();
        for (Annotation annotation : annotations) {
            ClassValidationAnnotationHandler handler = handlerRegistry.findClassHanlder(annotation, clazz);
            if (handler == null) {
                logger.warn("No hanlder is defined for annotation '" + annotation.annotationType().getName() +
                    "'... Annotation will be ignored...");
            } else {
                handler.handleAnnotation(annotation, clazz, configuration);
            }
        }
    }
View Full Code Here


    public void testSetExtraClassHandlers() throws Exception {
        List<ClassValidationAnnotationHandler> handlers = new ArrayList<ClassValidationAnnotationHandler>();
        handlers.add(createClassHandler(false));
        handlers.add(createClassHandler(false));
        handlers.add(createClassHandler(false));
        ClassValidationAnnotationHandler h1 = createClassHandler(true);
        handlers.add(h1);

        registry.setExtraClassHandlers(handlers);

        Object returnedHandler = registry.findClassHanlder(getAnnotation(), Object.class);
View Full Code Here

    protected Annotation getAnnotation() {
        return getClass().getAnnotation(TestAnnotation.class);
    }

    protected ClassValidationAnnotationHandler createClassHandler(final boolean supports) {
        return new ClassValidationAnnotationHandler() {
            public boolean supports(Annotation annotation, Class clazz) {
                return supports;
            }
            public void handleAnnotation(Annotation annotation, Class clazz, MutableBeanValidationConfiguration configuration) {
            }
View Full Code Here

        Annotation[] annotations = clazz.getAnnotations();
        for (Annotation annotation : annotations) {
            if (!isValidationAnnotation(annotation)) {
                continue;
            }
            ClassValidationAnnotationHandler handler = handlerRegistry.findClassHanlder(annotation, clazz);
            if (handler == null) {
                logger.warn("No handler is defined for annotation '" + annotation.annotationType().getName() +
                    "'... Annotation will be ignored...");
            } else {
                handler.handleAnnotation(annotation, clazz, configuration);
            }
        }
    }
View Full Code Here

    public void testSetExtraClassHandlers() throws Exception {
        List<ClassValidationAnnotationHandler> handlers = new ArrayList<ClassValidationAnnotationHandler>();
        handlers.add(createClassHandler(false));
        handlers.add(createClassHandler(false));
        handlers.add(createClassHandler(false));
        ClassValidationAnnotationHandler h1 = createClassHandler(true);
        handlers.add(h1);

        registry.setExtraClassHandlers(handlers);

        Object returnedHandler = registry.findClassHanlder(getAnnotation(), Object.class);
View Full Code Here

    protected Annotation getAnnotation() {
        return getClass().getAnnotation(TestAnnotation.class);
    }

    protected ClassValidationAnnotationHandler createClassHandler(final boolean supports) {
        return new ClassValidationAnnotationHandler() {
            public boolean supports(Annotation annotation, Class clazz) {
                return supports;
            }

            public void handleAnnotation(Annotation annotation, Class clazz, MutableBeanValidationConfiguration configuration) {
View Full Code Here

TOP

Related Classes of org.springmodules.validation.bean.conf.loader.annotation.handler.ClassValidationAnnotationHandler

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.