1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.domain.validation;
17
18 import org.springframework.util.Assert;
19
20 import org.springframework.validation.BindException;
21
22
23 /***
24 * Convenience class that invokes the {@link BindBeforeValidation} interface if
25 * the passed domain object has requested it.
26 *
27 * @author Ben Alex
28 * @version $Id: BindBeforeValidationUtils.java,v 1.2 2005/11/17 00:55:50 benalex Exp $
29 */
30 public class BindBeforeValidationUtils {
31
32
33 /***
34 * Call {@link BindBeforeValidation#bindSupport()} if the domain object
35 * requests it.
36 *
37 * @param domainObject to attempt to bind (never <code>null</code>)
38 *
39 * @throws BindException if the binding failed
40 */
41 public static void bindIfRequired(Object domainObject)
42 throws BindException {
43 Assert.notNull(domainObject);
44
45 if (BindBeforeValidation.class.isAssignableFrom(domainObject.getClass())) {
46 BindBeforeValidation bbv = (BindBeforeValidation) domainObject;
47 bbv.bindSupport();
48 }
49 }
50 }