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.util.documentserializer;
017
018import org.kuali.rice.krad.document.Document;
019
020/**
021 * Specifies an implementation used during document workflow XML serialization that
022 * will be able to determine whether a specific property is serializable
023 *
024 */
025public interface PropertySerializabilityEvaluator {
026    
027    /**
028     * Initializes the evaluator so that calls to {@link #isPropertySerializable(DocumentSerializationState, Object, String, Object)} and
029     * {@link #determinePropertyType(Object)} will function properly
030     * 
031     * @param document the document instance
032     */
033    public void initializeEvaluatorForDocument(Document document);
034    
035    public void initializeEvaluatorForDataObject(Object businessObject);
036    
037    /**
038     * Determines whether a child property of an object is serializable.
039     * 
040     * @param state Information about the properties that have been serialized so far
041     * @param containingObject The object containing the reference to childPropertyValue
042     * @param childPropertyName The name property to determine whether to serialize, relative to containingObject (i.e. not a nested attribute) 
043     * @param childPropertyValue If serializable, this property would be serialized by the serializer service.
044     * @return
045     */
046    public boolean isPropertySerializable(SerializationState state, Object containingObject, String childPropertyName, Object childPropertyValue);
047    
048    /**
049     * Determines the type of a object
050     * 
051     * @param object
052     * @return
053     */
054    public PropertyType determinePropertyType(Object object);
055}