1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.morph.reflect.reflectors;
17
18 import javax.servlet.ServletRequest;
19
20 /**
21 * Exposes servlet request attributes.
22 *
23 * @author Matt Sgarlata
24 * @since Nov 21, 2004
25 */
26 public class ServletRequestAttributeReflector extends BaseServletReflector {
27
28 private static final Class[] REFLECTABLE_TYPES = new Class[] {
29 ServletRequest.class
30 };
31
32 protected ServletRequest getRequest(Object bean) {
33 return (ServletRequest) bean;
34 }
35
36 protected String[] getPropertyNamesImpl(Object bean) throws Exception {
37 return enumerationToStringArray(getRequest(bean).getAttributeNames());
38 }
39
40 protected Object getImpl(Object bean, String propertyName) throws Exception {
41 return getRequest(bean).getAttribute(propertyName);
42 }
43
44 protected void setImpl(Object bean, String propertyName, Object value)
45 throws Exception {
46 getRequest(bean).setAttribute(propertyName, value);
47 }
48
49 public Class[] getReflectableClassesImpl() {
50 return REFLECTABLE_TYPES;
51 }
52
53 }