litesoft
Diff Revisions
916
vs
917
for /trunk/Java/core/Anywhere/src/org/litesoft/mementobeansupport/AbstractMementoBean.java
|
@@ -6,6 +6,7 @@ |
6 |
6 |
|
import org.litesoft.core.annotations.*; |
7 |
7 |
|
import org.litesoft.core.simpletypes.nonpublic.*; |
8 |
8 |
|
import org.litesoft.core.typeutils.*; |
|
9 |
+ |
import org.litesoft.core.typeutils.Objects; |
9 |
10 |
|
import org.litesoft.core.util.*; |
10 |
11 |
|
|
11 |
12 |
|
public abstract class AbstractMementoBean<CT extends AbstractMementoBean> implements Cloneable, |
|
@@ -50,7 +51,7 @@ |
50 |
51 |
|
} |
51 |
52 |
|
CT zClone = copy(); |
52 |
53 |
|
AbstractAttributeProxy<T, ?> zProxy = getProxy( pIndex ); |
53 |
|
- |
zClone.mAttributeProxies[pIndex] = zProxy.set( pValue ); |
|
54 |
+ |
castBase( zClone ).mAttributeProxies[pIndex] = zProxy.set( pValue ); |
54 |
55 |
|
return zClone; |
55 |
56 |
|
} |
56 |
57 |
|
|
|
@@ -86,7 +87,7 @@ |
86 |
87 |
|
} |
87 |
88 |
|
CT zClone = copy(); |
88 |
89 |
|
AbstractAttributeProxy<T, ?> zProxy = getProxy( pIndex ); |
89 |
|
- |
zClone.mAttributeProxies[pIndex] = zProxy.setRepeating( pValues ); |
|
90 |
+ |
castBase( zClone ).mAttributeProxies[pIndex] = zProxy.setRepeating( pValues ); |
90 |
91 |
|
return zClone; |
91 |
92 |
|
} |
92 |
93 |
|
|
|
@@ -169,15 +170,16 @@ |
169 |
170 |
|
@Override |
170 |
171 |
|
public CT fromMemento( @NotNull CharSource pToMemoValue ) |
171 |
172 |
|
{ |
172 |
|
- |
return Cast.it( defaultInstance().defaultFromMemento( pToMemoValue ) ); |
|
173 |
+ |
return Cast.it( castBase( defaultInstance() ).defaultFromMemento( pToMemoValue ) ); |
173 |
174 |
|
} |
174 |
175 |
|
|
175 |
176 |
|
private CT defaultFromMemento( @NotNull CharSource pToMemoValue ) |
176 |
177 |
|
{ |
177 |
178 |
|
CT zCopy = copy(); |
|
179 |
+ |
AbstractMementoBean zClone = castBase( zCopy ); |
178 |
180 |
|
for ( int i = 0; i < mAttributeProxies.length; i++ ) |
179 |
181 |
|
{ |
180 |
|
- |
zCopy.mAttributeProxies[i] = getProxy( i ).fromMemento( pToMemoValue ); |
|
182 |
+ |
zClone.mAttributeProxies[i] = getProxy( i ).fromMemento( pToMemoValue ); |
181 |
183 |
|
} |
182 |
184 |
|
return zCopy; |
183 |
185 |
|
} |
|
@@ -205,4 +207,9 @@ |
205 |
207 |
|
} |
206 |
208 |
|
return pSB; |
207 |
209 |
|
} |
|
210 |
+ |
|
|
211 |
+ |
protected final AbstractMementoBean castBase( CT pCT ) |
|
212 |
+ |
{ |
|
213 |
+ |
return (AbstractMementoBean) pCT; |
|
214 |
+ |
} |
208 |
215 |
|
} |