1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.datadictionary.impl;
17
18 import java.lang.reflect.InvocationTargetException;
19
20 import org.apache.commons.beanutils.BeanUtils;
21 import org.kuali.rice.kns.datadictionary.FieldOverride;
22
23
24
25
26
27
28
29 public class FieldOverrideForValueReplaceImpl implements FieldOverride{
30
31 private String propertyName;
32 private Object value;
33
34 public String getPropertyName() {
35 return propertyName;
36 }
37
38 public void setPropertyName(String propertyName) {
39 this.propertyName = propertyName;
40 }
41
42 public Object getValue() {
43 return value;
44 }
45
46 public void setValue(Object value) {
47 this.value = value;
48 }
49
50 public Object performFieldOverride(Object bean, Object property) {
51 try {
52 BeanUtils.setProperty(bean, this.getPropertyName(), this.getValue());
53 } catch (IllegalAccessException e) {
54 throw new RuntimeException(e);
55 } catch (InvocationTargetException e) {
56 throw new RuntimeException(e);
57 }
58
59 return getValue();
60 }
61 }