View Javadoc

1   /*
2    * Copyright 2004-2005, 2008 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package net.sf.morph.reflect.reflectors;
17  
18  import net.sf.morph.reflect.BeanReflector;
19  
20  /**
21   * Convenient base class for BeanReflectors.  Validates arguments and takes care
22   * of logging and exception handling.
23   * 
24   * @author Matt Sgarlata
25   * @since Nov 14, 2004
26   */
27  public abstract class BaseBeanReflector extends BaseReflector implements BeanReflector {
28  
29  	/**
30  	 * Template method must be overridden.
31  	 * {@inheritDoc}
32  	 */
33  	protected abstract String[] getPropertyNamesImpl(Object bean) throws Exception;
34  
35  	/**
36  	 * Template method must be overridden.
37  	 * {@inheritDoc}
38  	 */
39  	protected abstract Class getTypeImpl(Object bean, String propertyName)
40  			throws Exception;
41  
42  	/**
43  	 * Template method must be overridden.
44  	 * {@inheritDoc}
45  	 */
46  	protected abstract Object getImpl(Object bean, String propertyName) throws Exception;
47  
48  	/**
49  	 * Template method must be overridden.
50  	 * {@inheritDoc}
51  	 */
52  	protected abstract void setImpl(Object bean, String propertyName, Object value)
53  			throws Exception;
54  
55  	// isReadable and isWriteable are not marked abstract here because default
56  	// implementations are provided in BaseReflector
57  
58  }