001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.bo;
017
018import org.apache.commons.lang.builder.ReflectionToStringBuilder;
019import org.apache.commons.lang3.ClassUtils;
020
021import java.lang.reflect.Field;
022
023/**
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 * @deprecated use new KRAD Data framework {@link org.kuali.rice.krad.data.DataObjectService}
026 */
027@Deprecated
028public abstract class BusinessObjectBase implements BusinessObject {
029
030    /**
031     * Default constructor. Required to do some of the voodoo involved in letting the DataDictionary validate attributeNames for a
032     * given BusinessObject subclass.
033     */
034    public BusinessObjectBase() {
035    }
036
037    @Override
038        public String toString() {
039        class BusinessObjectToStringBuilder extends ReflectionToStringBuilder {
040
041            private BusinessObjectToStringBuilder(Object object) {
042                super(object);
043            }
044
045            @Override
046            public boolean accept(Field field) {
047                return String.class.isAssignableFrom(field.getType())
048                        || ClassUtils.isPrimitiveOrWrapper(field.getType());
049            }
050
051        }
052
053        return new BusinessObjectToStringBuilder(this).toString();
054    }
055
056}