01: //$Id: LazyPropertyInitializer.java 9210 2006-02-03 22:15:19Z steveebersole $
02: package org.hibernate.intercept;
03:
04: import java.io.Serializable;
05:
06: import org.hibernate.HibernateException;
07: import org.hibernate.engine.SessionImplementor;
08:
09: /**
10: * Contract for controlling how lazy properties get initialized.
11: *
12: * @author Gavin King
13: */
14: public interface LazyPropertyInitializer {
15:
16: /**
17: * Marker value for uninitialized properties
18: */
19: public static final Serializable UNFETCHED_PROPERTY = new Serializable() {
20: public String toString() {
21: return "<lazy>";
22: }
23:
24: public Object readResolve() {
25: return UNFETCHED_PROPERTY;
26: }
27: };
28:
29: /**
30: * Initialize the property, and return its new value
31: */
32: public Object initializeLazyProperty(String fieldName,
33: Object entity, SessionImplementor session)
34: throws HibernateException;
35:
36: }
|