View Javadoc

1   /*
2    * Copyright 2004-2005 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 java.util.ArrayList;
19  import java.util.Enumeration;
20  import java.util.List;
21  
22  /**
23   * Base class for reflectors that reflect objects from the Servlet API. 
24   * 
25   * @author Matt Sgarlata
26   * @since Nov 30, 2004
27   */
28  public abstract class BaseServletReflector extends BaseBeanReflector {
29  	
30  	protected String[] enumerationToStringArray(Enumeration e) {
31  		// don't use a converter here for performance issues (reflectors are
32  		// low level components so they need high performance) and because
33  		// it's better not to have reflectors depending on converters since
34  		// reflectors are lower on the call stack
35  		List list = new ArrayList();
36  		while (e.hasMoreElements()) {
37  			list.add(e.nextElement());
38  		}
39  		return (String[]) list.toArray(new String[list.size()]);
40  	}
41  	
42  	protected boolean isReadableImpl(Object bean, String propertyName)
43  		throws Exception {
44  		return true;
45  	}
46  	
47  	protected Class getTypeImpl(Object bean, String propertyName) throws Exception {
48  		return Object.class;
49  	}
50  
51  }