1 /* 2 * Copyright 2004-2009 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springmodules.validation.commons; 18 19 /** 20 * A bean validator that is aware of the page attribute in the form configuration. 21 * This may be useful for partial bean validation (that is, selected properties of the bean) needed 22 * for example in web wizard controllers. 23 * 24 * @author Uri Boness 25 */ 26 public class ConfigurablePageBeanValidator extends AbstractPageBeanValidator { 27 28 private String formName; 29 30 /** 31 * Default constructor (javabean support) 32 */ 33 public ConfigurablePageBeanValidator() { 34 } 35 36 /** 37 * Constructs a new DefaultPageBeanValidator with a given page to validate. 38 * 39 * @param page The page that should be validated by this validator. 40 */ 41 public ConfigurablePageBeanValidator(int page) { 42 super(page); 43 } 44 45 /** 46 * If <code>useFullyQualifiedClassName</code> is false (default value), this function returns a 47 * string containing the uncapitalized, short name for the given class 48 * (e.g. myBean for the class com.domain.test.MyBean). Otherwise, it returns the value 49 * returned by <code>Class.getName()</code>. 50 * 51 * @param cls <code>Class</code> of the bean to be validated. 52 * @return the bean name. 53 */ 54 protected String getFormName(Class cls) { 55 return formName; 56 } 57 58 public void setFormName(String formName) { 59 this.formName = formName; 60 } 61 62 }