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.http.HttpSession;
19
20 /**
21 * Exposes HTTP session attributes.
22 *
23 * @author Matt Sgarlata
24 * @since Nov 21, 2004
25 */
26 public class HttpSessionAttributeReflector extends BaseServletReflector {
27
28 private static final Class[] REFLECTABLE_TYPES = new Class[] {
29 HttpSession.class
30 };
31
32 protected HttpSession getSession(Object bean) {
33 return (HttpSession) bean;
34 }
35
36 protected String[] getPropertyNamesImpl(Object bean) throws Exception {
37 return enumerationToStringArray(getSession(bean).getAttributeNames());
38 }
39
40 protected Object getImpl(Object bean, String propertyName) throws Exception {
41 return getSession(bean).getAttribute(propertyName);
42 }
43
44 protected void setImpl(Object bean, String propertyName, Object value) throws Exception {
45 getSession(bean).setAttribute(propertyName, value);
46 }
47
48 public Class[] getReflectableClassesImpl() {
49 return REFLECTABLE_TYPES;
50 }
51
52 }