001    /*
002     * Copyright 2005 (C) Our Community Pty. Ltd. All Rights Reserved
003     * 
004     * $Id$
005     */
006    
007    package org.springframework.binding.form.support;
008    
009    import org.springframework.beans.BeansException;
010    import org.springframework.binding.support.BeanPropertyAccessStrategy;
011    import org.springframework.binding.value.ValueModel;
012    
013    public class TestPropertyAccessStrategy extends BeanPropertyAccessStrategy {
014        
015        private int numValueModelRequests;
016        private String lastRequestedValueModel;
017    
018        public TestPropertyAccessStrategy(Object bean) {
019            super(bean);
020        }
021    
022        public ValueModel getPropertyValueModel(String propertyPath) throws BeansException {
023            numValueModelRequests++;
024            lastRequestedValueModel = propertyPath;
025            return super.getPropertyValueModel(propertyPath);
026        }
027        
028        public int numValueModelRequests() {
029            return numValueModelRequests;
030        }
031    
032        public String lastRequestedValueModel() {
033            return lastRequestedValueModel;
034        }
035    }