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.bo;
17  
18  import org.apache.commons.lang.builder.ReflectionToStringBuilder;
19  import org.apache.commons.lang3.ClassUtils;
20  
21  import java.lang.reflect.Field;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   * @deprecated use new KRAD Data framework {@link org.kuali.rice.krad.data.DataObjectService}
26   */
27  @Deprecated
28  public abstract class BusinessObjectBase implements BusinessObject {
29  
30      /**
31       * Default constructor. Required to do some of the voodoo involved in letting the DataDictionary validate attributeNames for a
32       * given BusinessObject subclass.
33       */
34      public BusinessObjectBase() {
35      }
36  
37      @Override
38  	public String toString() {
39          class BusinessObjectToStringBuilder extends ReflectionToStringBuilder {
40  
41              private BusinessObjectToStringBuilder(Object object) {
42                  super(object);
43              }
44  
45              @Override
46              public boolean accept(Field field) {
47                  return String.class.isAssignableFrom(field.getType())
48                          || ClassUtils.isPrimitiveOrWrapper(field.getType());
49              }
50  
51          }
52  
53          return new BusinessObjectToStringBuilder(this).toString();
54      }
55  
56  }