001    
002    /*
003     * Copyright (C) 2011 Archie L. Cobbs. All rights reserved.
004     *
005     * $Id: SelfValidating.java 58 2011-03-08 15:58:21Z archie.cobbs $
006     */
007    
008    package org.dellroad.stuff.validation;
009    
010    import javax.validation.ConstraintValidatorContext;
011    
012    /**
013     * Implemented by classes that can validate themselves. Such classes should be annotated with
014     * the {@link SelfValidates @SelfValidates} constraint.
015     *
016     * @see SelfValidates
017     */
018    public interface SelfValidating {
019    
020        /**
021         * Validate this instance.
022         *
023         * @throws SelfValidationException to indicate this instance is invalid
024         */
025        void checkValid(ConstraintValidatorContext context) throws SelfValidationException;
026    }
027