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