1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.argeo.slc.core.execution;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20 import org.springframework.beans.factory.FactoryBean;
21
22 public class ParameterRef implements FactoryBean<Object> {
23 private final static Log log = LogFactory.getLog(ParameterRef.class);
24
25 private InstantiationManager instantiationManager;
26 private String name;
27
28
29 private Object object;
30
31 public ParameterRef() {
32 }
33
34 public ParameterRef(String name) {
35 this.name = name;
36 }
37
38 public Object getObject() throws Exception {
39 if (log.isTraceEnabled())
40 log.debug("Parameter ref called for " + name);
41
42 if (object == null)
43 object = instantiationManager.getInitializingFlowParameter(name);
44 return object;
45 }
46
47 public Class<?> getObjectType() {
48 if (object == null)
49 return instantiationManager.getInitializingFlowParameterClass(name);
50 else
51 return object.getClass();
52 }
53
54 public boolean isSingleton() {
55 return true;
56 }
57
58 public void setInstantiationManager(
59 InstantiationManager instantiationManager) {
60 this.instantiationManager = instantiationManager;
61 }
62
63 public void setName(String name) {
64 this.name = name;
65 }
66
67 }