View Javadoc

    1   /* Copyright 2004, 2005 Acegi Technology Pty Limited
    2    *
    3    * Licensed under the Apache License, Version 2.0 (the "License");
    4    * you may not use this file except in compliance with the License.
    5    * You may obtain a copy of the License at
    6    *
    7    *     http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    * Unless required by applicable law or agreed to in writing, software
    10   * distributed under the License is distributed on an "AS IS" BASIS,
    11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12   * See the License for the specific language governing permissions and
    13   * limitations under the License.
    14   */
    15
    16  package org.acegisecurity.domain.validation;
    17
    18  import org.springframework.validation.BindException;
    19
    20
    21  /***
    22   * Indicates a domain object wishes to perform additional binding before the
    23   * <code>Validator</code> is called.
    24   *
    25   * <p>
    26   * Typically this type of binding sets up private or protected properties that
    27   * the end user is not responsible for modifying. Whilst generally this can be
    28   * done by adding a hook to every property setter, the
    29   * <code>BindBeforeValidation</code> interface provides an AOP-style approach
    30   * that ensures missing hooks do not cause invalid object state.
    31   * </p>
    32   *
    33   * @author Ben Alex
    34   * @version $Id: BindBeforeValidation.java,v 1.2 2005/11/17 00:55:50 benalex Exp $
    35   */
    36  public interface BindBeforeValidation {
    37      //~ Methods ================================================================
    38
    39      /***
    40       * This method will be called by infrastructure code before attempting to
    41       * validate the object. Given this method is called prior to validation,
    42       * implementations of this method should <b>not</b> assume the object is
    43       * in a valid state.
    44       *
    45       * <p>
    46       * Implementations should modify the object as required so that the
    47       * <code>Validator</code> will succeed if user-controllable properties are
    48       * correct.
    49       * </p>
    50       *
    51       * @throws BindException if there are problems that the method wish to
    52       *         advise (note that the <code>Validator</code> should be allowed
    53       *         to determine errors in most cases, rather than this method
    54       *         doing so)
    55       */
    56      public void bindSupport() throws BindException;
    57  }