001/*
002 * Copyright 2002-2014 the original author or authors.
003 *
004 * Licensed under the Apache 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 *      https://www.apache.org/licenses/LICENSE-2.0
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 */
016
017package org.springframework.beans;
018
019import org.springframework.core.convert.ConversionService;
020
021/**
022 * Interface that encapsulates configuration methods for a PropertyAccessor.
023 * Also extends the PropertyEditorRegistry interface, which defines methods
024 * for PropertyEditor management.
025 *
026 * <p>Serves as base interface for {@link BeanWrapper}.
027 *
028 * @author Juergen Hoeller
029 * @author Stephane Nicoll
030 * @since 2.0
031 * @see BeanWrapper
032 */
033public interface ConfigurablePropertyAccessor extends PropertyAccessor, PropertyEditorRegistry, TypeConverter {
034
035        /**
036         * Specify a Spring 3.0 ConversionService to use for converting
037         * property values, as an alternative to JavaBeans PropertyEditors.
038         */
039        void setConversionService(ConversionService conversionService);
040
041        /**
042         * Return the associated ConversionService, if any.
043         */
044        ConversionService getConversionService();
045
046        /**
047         * Set whether to extract the old property value when applying a
048         * property editor to a new value for a property.
049         */
050        void setExtractOldValueForEditor(boolean extractOldValueForEditor);
051
052        /**
053         * Return whether to extract the old property value when applying a
054         * property editor to a new value for a property.
055         */
056        boolean isExtractOldValueForEditor();
057
058        /**
059         * Set whether this instance should attempt to "auto-grow" a
060         * nested path that contains a {@code null} value.
061         * <p>If {@code true}, a {@code null} path location will be populated
062         * with a default object value and traversed instead of resulting in a
063         * {@link NullValueInNestedPathException}.
064         * <p>Default is {@code false} on a plain PropertyAccessor instance.
065         */
066        void setAutoGrowNestedPaths(boolean autoGrowNestedPaths);
067
068        /**
069         * Return whether "auto-growing" of nested paths has been activated.
070         */
071        boolean isAutoGrowNestedPaths();
072
073}