001    /*******************************************************************************
002     * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian
003     * Thomschke.
004     * 
005     * All Rights Reserved. This program and the accompanying materials
006     * are made available under the terms of the Eclipse Public License v1.0
007     * which accompanies this distribution, and is available at
008     * http://www.eclipse.org/legal/epl-v10.html
009     * 
010     * Contributors:
011     *     Sebastian Thomschke - initial implementation.
012     *******************************************************************************/
013    package net.sf.oval.constraint.exclusion;
014    
015    import java.lang.annotation.Documented;
016    import java.lang.annotation.ElementType;
017    import java.lang.annotation.Retention;
018    import java.lang.annotation.RetentionPolicy;
019    import java.lang.annotation.Target;
020    
021    import net.sf.oval.configuration.annotation.Exclusion;
022    
023    /**
024     * Allows a value to be nullable.
025     * 
026     * @author Sebastian Thomschke
027     */
028    @Documented
029    @Retention(RetentionPolicy.RUNTIME)
030    @Target({ElementType.PARAMETER})
031    @Exclusion(excludeWith = NullableExclusion.class)
032    public @interface Nullable
033    {
034            /**
035             * The associated constraint profiles.
036             */
037            String[] profiles() default {};
038    
039            /**
040             * Formula returning <code>true</code> if this constraint exclusion shall be active and
041             * <code>false</code> if it shall be ignored for the current validation.
042             * <p>
043             * <b>Important:</b> The formula must be prefixed with the name of the scripting language that is used.
044             * E.g. <code>groovy:_this.amount > 10</code>
045             * <p>
046             * Available context variables are:<br>
047             * <b>_this</b> -&gt; the validated bean<br>
048             * <b>_value</b> -&gt; the value to validate (e.g. the field value, parameter value, method return value,
049             *    or the validated bean for object level constraints)
050             */
051            String when() default "";
052    }