01: package com.completex.objective.components.persistency.mapper;
02:
03: import com.completex.objective.components.persistency.PersistentObject;
04: import com.completex.objective.components.persistency.CompoundPersistentObject;
05:
06: import java.util.Map;
07:
08: /**
09: * Converts persistent objects to corresponding beans without pre-defined mapping.
10: *
11: * @author Gennady Krizhevsky
12: */
13: public interface AdHocPoBeanConverter {
14: /**
15: *
16: * Converts persistent object to corresponding bean
17: *
18: * @param po persistent object
19: * @param beanClass bean class
20: * @return bean populated with persistent object data
21: */
22: Object convert(PersistentObject po, Class beanClass);
23:
24: /**
25: * Converts compound persistent object to corresponding bean array.
26: * If number of entries in the compound persistent object > bean classes array size
27: * then the common ones get converted, the extra ones get returned unconverted. That is
28: * the size of resulting array is equal to the size of the compound entries one.
29: *
30: * @param cpo compound persistent object
31: * @param beanClasses bean classes array
32: * @return bean array populated with persistent object data
33: */
34: Object[] convert(CompoundPersistentObject cpo, Class[] beanClasses);
35:
36: /**
37: * Converts persistent object to corresponding bean
38: *
39: * @param po persistent object
40: * @param beanClass bean class
41: * @param typeMap type map containing PersistentEntry column of Link name as a key and
42: * the corresponding bean class as a value
43: * @return bean populated with persistent object data
44: */
45: Object convert(PersistentObject po, Class beanClass, Map typeMap);
46: }
|