All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jsimpledb.annotation.OnValidate Maven / Gradle / Ivy

The newest version!

/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package org.jsimpledb.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotates a JSimpleDB model class method that should be invoked any time the associated model object is validated.
 *
 * 

* This annotation does not change when an object will be enqueued for validation. It only affects the behavior once validation * of an instance is actually performed. * *

* When validating an object, validation via {@link OnValidate @OnValidate} methods occurs after JSR 303 validation, if any. * *

* An optional list of validation {@link #groups} may be specified; if so, the annotated method will only be invoked when * one or more of specified validation groups (or a superclass thereof) is being validated. In particular, if {@link #groups} * is non-empty and does not contain a class that extends {@link javax.validation.groups.Default}, then the method will * not be invoked by automatic validation. * *

* The annotated method must be an instance method (i.e., not static), return void, and take zero parameters. * If validation fails, the method should throw a {@link org.jsimpledb.ValidationException}. * *

Meta-Annotations

* *

* This annotation may be configured indirectly as a Spring * meta-annotation * when {@code spring-core} is on the classpath. * * @see org.jsimpledb.JTransaction#validate * @see org.jsimpledb.JObject#revalidate * @see org.jsimpledb.ValidationMode */ @Documented @Inherited @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) public @interface OnValidate { /** * Specify the validation group(s) for which the annotated method should be invoked. * * @return validation group(s) to use for validation; if empty, {@link javax.validation.groups.Default} is assumed */ Class[] groups() default {}; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy