1 24 package org.riotfamily.website.generic.model.hibernate; 25 26 import javax.servlet.http.HttpServletRequest ; 27 28 import org.riotfamily.common.beans.PropertyUtils; 29 30 31 public abstract class AbstractParameterResolver implements ParameterResolver { 32 33 private String name; 34 35 private String property; 36 37 public void setParam(String name) { 38 this.name = name; 39 } 40 41 public void setProperty(String property) { 42 this.property = property; 43 } 44 45 protected String getName() { 46 return name; 47 } 48 49 public boolean accept(String name) { 50 return this.name.equals(name); 51 } 52 53 public boolean includeInCacheKey() { 54 return true; 55 } 56 57 public Object getValue(HttpServletRequest request) { 58 Object value = getValueInternal(request); 59 if (property != null && value != null) { 60 value = PropertyUtils.getProperty(value, property); 61 } 62 return value; 63 } 64 65 protected abstract Object getValueInternal(HttpServletRequest request); 66 67 } 68 | Popular Tags |