1 /**
2 * Copyright 2005-2013 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.lang.builder.ToStringBuilder;
20 import org.apache.commons.lang.builder.ToStringStyle;
21
22 import java.lang.reflect.Field;
23 import java.util.LinkedHashMap;
24
25 /**
26 * @author Kuali Rice Team (rice.collab@kuali.org)
27 */
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 private BusinessObjectToStringBuilder(Object object) {
41 super(object);
42 }
43
44 public boolean accept(Field field) {
45 if (BusinessObject.class.isAssignableFrom(field.getType())) {
46 return false;
47 }
48 return super.accept(field);
49 }
50 };
51 ReflectionToStringBuilder toStringBuilder = new BusinessObjectToStringBuilder(this);
52 return toStringBuilder.toString();
53 }
54
55 }