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.beans.FatalBeanException;
020    
021    /**
022     * A strategy for accessing a domain object's properties. Different
023     * implementations could access different backing objects such as a javabean
024     * <code>(BeanPropertyAccessStrategy)</code>, hashmap, rowset, or other data
025     * structure.
026     * 
027     * @author Keith Donald
028     */
029    public interface PropertyAccessStrategy {
030    
031            /**
032             * Get the value of a property.
033             * 
034             * @param propertyPath name of the property to get the value of
035             * @return the value of the property
036             * @throws FatalBeanException if there is no such property, if the property
037             * isn't readable, or if the property getter throws an exception.
038             */
039            Object getPropertyValue(String propertyPath) throws BeansException;
040    
041            /**
042             * Get a metadata accessor, which can return meta information about
043             * particular properties of the backed domain object.
044             * 
045             * @return The meta accessor.
046             */
047            PropertyMetadataAccessStrategy getMetadataAccessStrategy();
048    
049            /**
050             * Return the target, backing domain object for which property access
051             * requests are targeted against.
052             * 
053             * @return The backing target object.
054             */
055            Object getDomainObject();
056    
057    }