01: /*
02: * User: Michael Rettig
03: * Date: Aug 10, 2002
04: * Time: 1:11:01 PM
05: */
06: package net.sourceforge.jaxor;
07:
08: import net.sourceforge.jaxor.api.ObjectHolder;
09:
10: import java.io.Serializable;
11:
12: public abstract class LazyLoader implements Serializable, ObjectHolder {
13: private Object _result;
14: private boolean _resolved = false;
15:
16: protected abstract Object resolve();
17:
18: public Object getValue() {
19: if (!_resolved) {
20: setValue(resolve());
21: }
22: return _result;
23: }
24:
25: public void setValue(Object result) {
26: _result = result;
27: _resolved = true;
28: }
29: }
|