litesoft
Diff Revisions
777
vs
779
for /trunk/Java/core/Anywhere/src/org/litesoft/memobeansupport/AbstractMemoBean.java
|
@@ -18,6 +18,12 @@ |
18 |
18 |
|
mAttributeProxies = pAttributeProxies; |
19 |
19 |
|
} |
20 |
20 |
|
|
|
21 |
+ |
protected AbstractMemoBean( AbstractMemoBean<CT> pOrig ) |
|
22 |
+ |
{ |
|
23 |
+ |
this.mAttributeProxies = new AbstractAttributeProxy[pOrig.mAttributeProxies.length]; |
|
24 |
+ |
System.arraycopy( pOrig.mAttributeProxies, 0, this.mAttributeProxies, 0, pOrig.mAttributeProxies.length ); |
|
25 |
+ |
} |
|
26 |
+ |
|
21 |
27 |
|
public final boolean isEmpty() |
22 |
28 |
|
{ |
23 |
29 |
|
for ( AbstractAttributeProxy zProxy : mAttributeProxies ) |
|
@@ -41,7 +47,7 @@ |
41 |
47 |
|
{ |
42 |
48 |
|
return cast( this ); |
43 |
49 |
|
} |
44 |
|
- |
CT zClone = clone(); |
|
50 |
+ |
CT zClone = copy(); |
45 |
51 |
|
AbstractAttributeProxy<T, ?> zProxy = getProxy( pIndex ); |
46 |
52 |
|
zClone.mAttributeProxies[pIndex] = zProxy.set( pValue ); |
47 |
53 |
|
return zClone; |
|
@@ -77,7 +83,7 @@ |
77 |
83 |
|
{ |
78 |
84 |
|
return cast( this ); |
79 |
85 |
|
} |
80 |
|
- |
CT zClone = clone(); |
|
86 |
+ |
CT zClone = copy(); |
81 |
87 |
|
AbstractAttributeProxy<T, ?> zProxy = getProxy( pIndex ); |
82 |
88 |
|
zClone.mAttributeProxies[pIndex] = zProxy.setRepeating( pValues ); |
83 |
89 |
|
return zClone; |
|
@@ -88,20 +94,7 @@ |
88 |
94 |
|
return cast( mAttributeProxies[pIndex] ); |
89 |
95 |
|
} |
90 |
96 |
|
|
91 |
|
- |
@Override @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") |
92 |
|
- |
protected final CT clone() |
93 |
|
- |
{ |
94 |
|
- |
try |
95 |
|
- |
{ |
96 |
|
- |
CT zClone = cast( super.clone() ); |
97 |
|
- |
zClone.mAttributeProxies = mAttributeProxies.clone(); |
98 |
|
- |
return zClone; |
99 |
|
- |
} |
100 |
|
- |
catch ( CloneNotSupportedException e ) |
101 |
|
- |
{ |
102 |
|
- |
return null; // Stupid Java design where you say it implements Cloneable, but you still need to catch this stupid "checked" exception! |
103 |
|
- |
} |
104 |
|
- |
} |
|
97 |
+ |
abstract protected CT copy(); |
105 |
98 |
|
|
106 |
99 |
|
@SuppressWarnings({"unchecked"}) |
107 |
100 |
|
protected final <T> T cast( Object o ) |
|
@@ -173,7 +166,7 @@ |
173 |
166 |
|
@Override |
174 |
167 |
|
public CT fromMemo( @NotNull CharSource pToMemoValue ) |
175 |
168 |
|
{ |
176 |
|
- |
CT zClone = clone(); |
|
169 |
+ |
CT zClone = copy(); |
177 |
170 |
|
for ( int i = 0; i < mAttributeProxies.length; i++ ) |
178 |
171 |
|
{ |
179 |
172 |
|
zClone.mAttributeProxies[i] = getProxy( i ).fromMemo( pToMemoValue ); |