View Javadoc
1   /**
2    * Copyright 2005-2016 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.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.rice.krad.web.bind;
17  
18  import org.kuali.rice.krad.uif.view.ViewModel;
19  import org.springframework.beans.BeanWrapper;
20  import org.springframework.util.Assert;
21  import org.springframework.validation.BeanPropertyBindingResult;
22  
23  /**
24   * This is a description of what this class does - swgibson don't forget to fill this in. 
25   * 
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class UifBeanPropertyBindingResult extends BeanPropertyBindingResult {
29      private static final long serialVersionUID = -3740046436620585003L;
30  
31      public UifBeanPropertyBindingResult(Object target, String objectName,  boolean autoGrowNestedPaths, int autoGrowCollectionLimit) {
32          super(target, objectName, autoGrowNestedPaths, autoGrowCollectionLimit);
33      }
34  
35      /**
36       * Create a new {@link BeanWrapper} for the underlying target object.
37       * @see #getTarget()
38       */
39      @Override
40      protected UifViewBeanWrapper createBeanWrapper() {
41          Assert.state(super.getTarget() != null, "Cannot access properties on null bean instance '" + getObjectName() + "'!");
42          Assert.state(super.getTarget() instanceof ViewModel, "Object must be instance of ViewModel to use Uif Bean Wrapper");
43  
44          return new UifViewBeanWrapper((ViewModel) super.getTarget());
45      }
46  }