001    /*
002     * Copyright 2002-2004 the original author or authors.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005     * use this file except in compliance with the License. You may obtain a copy of
006     * the License at
007     *
008     * http://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, WITHOUT
012     * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013     * License for the specific language governing permissions and limitations under
014     * the License.
015     */
016    package org.springframework.binding;
017    
018    import org.springframework.beans.BeansException;
019    import org.springframework.binding.value.ValueModel;
020    
021    /**
022     * <p>
023     * An extension of the base property access strategy interface that allows for
024     * mutable operations. Specifically, this interface allows:
025     * </p>
026     * <ul>
027     * <li>registering custom property editors for performing type conversions</li>
028     * <li>returning a domain object holder allowing the underlying domain object
029     * to be changed and subscribed to for modification, and</li>
030     * <li>adding listeners for changes on particular properties.</li>
031     * </ul>
032     *
033     * @author Keith Donald
034     */
035    public interface MutablePropertyAccessStrategy extends PropertyAccessStrategy {
036    
037            /**
038             * Get the <code>ValueModel</code> used to access the domainObject.
039             *
040             * @return the <code>ValueModel</code> of the domainObject.
041             */
042            ValueModel getDomainObjectHolder();
043    
044            /**
045             * Get the <code>ValueModel</code> to access the given property. Possibly
046             * creating the valueModel if needed.
047             *
048             * @param propertyPath property to access.
049             * @return <code>ValueModel</code> that handles the given property.
050             * @throws BeansException
051             */
052            ValueModel getPropertyValueModel(String propertyPath) throws BeansException;
053    
054            /**
055             * Get a <code>MutablePropertyAccessStrategy</code> for the given
056             * property.
057             *
058             * TODO check why this exists and where this is used.
059             *
060             * @param propertyPath property.
061             * @return <code>MutablePropertyAccessStrategy</code> for the given
062             * property.
063             * @throws BeansException
064             */
065            MutablePropertyAccessStrategy getPropertyAccessStrategyForPath(String propertyPath) throws BeansException;
066    
067            /**
068             * Return a new <code>MutablePropertyAccessStrategy</code> for the given
069             * valueModel.
070             *
071             * TODO check why this exists and where this is used.
072             *
073             * @param domainObjectHolder a <code>ValueModel</code> containing the
074             * domainObject.
075             * @return a newly created <code>MutablePropertyAccessStrategy</code>.
076             */
077            MutablePropertyAccessStrategy newPropertyAccessStrategy(ValueModel domainObjectHolder);
078    
079    }