001/**
002 * Copyright 2005-2015 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
018/**
019 * This class represents metadata about the serializibility of a property during the document serialization proces..
020 */
021public interface PropertySerializabilityMetadata {
022    /**
023     * See docs for the elements of this enum
024     */
025    public enum PropertySerializability {
026        /**
027         * Indicates that the property represented by this metadata object should be serialized (i.e. have an open
028         * and close XML tag rendered) as well as all of the property's primitives.  It does not mean that all child
029         * non-primitive properties should be serialized.  Child non-primitives are only serialized if a call to
030         * {@link PropertySerializabilityMetadata#getSerializableSubProperty(String)} returns a non-null result when
031         * the child property name is passed in.
032         */
033        SERIALIZE_OBJECT_AND_ALL_PRIMITIVES,
034        
035        /**
036         * Indicates that the property represented by this metadata object should be serialized (i.e. have an open
037         * and close XML tag rendered).  Child properties (primitive or otherwise) are only serialized if a call to 
038         * {@link PropertySerializabilityMetadata#getSerializableSubProperty(String)} returns a non-null result when
039         * the child property name is passed in.
040         */
041        SERIALIZE_OBJECT
042    }
043
044    /**
045     * Returns the serializability of this property.  See {@link PropertySerializability}.
046     * 
047     * @return
048     */
049    public PropertySerializability getPropertySerializability();
050
051    /**
052     * Returns the full path string of the property corresponding to this metadata.
053     * 
054     * @return
055     */
056    public String getPathString();
057    
058    /**
059     * Returns metadata bout a child property, if it exists
060     * 
061     * @param childPropertyName the name of a child property, relative to this property (i.e. no .'s in the name)
062     * @return null if there is no child property with the specified name, otherwise, metadata about the child
063     */
064    public PropertySerializabilityMetadata getSerializableChildProperty(String childPropertyName);
065}