01: package com.xoetrope.data.pojo;
02:
03: import java.util.HashSet;
04:
05: public class XPersistentPojoAdapterEx extends XPojoAdapterEx {
06:
07: private HashSet propertyTransactions;
08:
09: /**
10: * Creates a new instance of XPersistentPojoAdapterEx class.
11: */
12: public XPersistentPojoAdapterEx(Class cl,
13: XPersistentPojoDataSourceEx ds) {
14: super (cl, ds);
15: propertyTransactions = new HashSet();
16: }
17:
18: /**
19: * Marks the the invocation of either the getter or the setter
20: * of the specified property requires an active transaction.
21: * @param propertyName the name of the property whose
22: * getter requires an active transaction.
23: */
24: protected void setTransaction(String propertyName) {
25: propertyTransactions.add(propertyName);
26: }
27:
28: /**
29: * Indicates whether the property (its getter and setter )requires an active transaction
30: * @param propertyName the name of the property whose getter is to be queried
31: * @return true if the specified getter exists and requires an active transaction,
32: * false otherwise
33: */
34: protected boolean requiresTransaction(String propertyName) {
35: return propertyTransactions.contains(propertyName);
36: }
37:
38: /**
39: * Marks that the invocation of the getter or the setter
40: * of the specified property does not require an active transaction.
41: * @propertyName the name of the property
42: */
43: protected void unsetTransaction(String propertyName) {
44: propertyTransactions.remove(propertyName);
45: }
46:
47: }
|