View Javadoc

1   /*
2    * Copyright 2007 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 1.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.opensource.org/licenses/ecl1.php
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  package org.kuali.student.common.validator;
17  
18  import java.util.List;
19  import java.util.Stack;
20  
21  import org.kuali.student.core.dictionary.dto.FieldDefinition;
22  import org.kuali.student.core.dictionary.dto.ObjectStructureDefinition;
23  import org.kuali.student.core.validation.dto.ValidationResultInfo;
24  
25  /**
26   * This is an abstract class that allows the sub implementations an option to reference ValidatorFactory.
27   * Any custom validator code that requires validatorFactory should extend this abstract class. 
28   * 
29   * @author Kuali Rice Team (kuali-rice@googlegroups.com)
30   *
31   */
32  public abstract class BaseAbstractValidator implements Validator {
33  
34      protected ValidatorFactory validatorFactory;    
35      
36      public ValidatorFactory getValidatorFactory() {
37          return validatorFactory;
38      }
39  
40      public void setValidatorFactory(ValidatorFactory validatorFactory) {
41          this.validatorFactory = validatorFactory;
42      }
43  
44      /**
45       * @see org.kuali.student.common.validator.Validator#validateObject(java.lang.Object, org.kuali.student.core.dictionary.dto.ObjectStructureDefinition)
46       */
47      @Override
48      public abstract List<ValidationResultInfo> validateObject(Object o, ObjectStructureDefinition objStructure);
49  
50      /**
51       * @see org.kuali.student.common.validator.Validator#validateObject(org.kuali.student.core.dictionary.dto.FieldDefinition, java.lang.Object, org.kuali.student.core.dictionary.dto.ObjectStructureDefinition, java.util.Stack)
52       */
53      @Override
54      public abstract List<ValidationResultInfo> validateObject(FieldDefinition field, Object o, ObjectStructureDefinition objStructure, Stack<String> elementStack);
55  }