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