Coverage Summary for Class: PersistableObject (net.sf.persism)
Class |
Class, %
|
Method, %
|
Line, %
|
PersistableObject |
100%
(1/1)
|
100%
(4/4)
|
71.4%
(5/7)
|
1 package net.sf.persism;
2
3 import net.sf.persism.annotations.NotColumn;
4
5 /**
6 * Persism uses information from this class to detect which properties are modified in your data objects and only
7 * includes those columns in the SQL UPDATE statements. Data objects can optionally inherit from this class.
8 *
9 * @author Dan Howard
10 * @since 9/15/11 7:14 AM
11 */
12 public abstract class PersistableObject<T> implements Persistable<T> {
13
14 @NotColumn
15 private T persismOriginalValue = null;
16
17 @Override
18 public final void saveReadState() throws PersismException {
19 persismOriginalValue = clone();
20 }
21
22 @Override
23 public final T readOriginalValue() {
24 return persismOriginalValue;
25 }
26
27 /**
28 * Used by saveReadState for persismOriginalValue
29 *
30 * @return Clone of T
31 */
32 @Override
33 public final T clone() {
34 try {
35 return (T) super.clone();
36 } catch (CloneNotSupportedException e) {
37 throw new PersismException(e.getMessage(), e);
38 }
39 }
40 }