KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > spi > persistence > support > sqlstore > sco > Vector


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * sco.Vector.java
26  */

27
28 package com.sun.jdo.spi.persistence.support.sqlstore.sco;
29
30 import java.util.Collection JavaDoc;
31 import java.util.Iterator JavaDoc;
32 import java.util.ResourceBundle JavaDoc;
33
34 import com.sun.jdo.api.persistence.support.JDOUserException;
35 import com.sun.jdo.api.persistence.support.JDOUnsupportedOptionException;
36 import com.sun.jdo.spi.persistence.support.sqlstore.PersistenceCapable;
37 import com.sun.jdo.spi.persistence.support.sqlstore.StateManager;
38 import com.sun.jdo.spi.persistence.support.sqlstore.SCOCollection;
39 import com.sun.jdo.spi.persistence.utility.I18NHelper;
40
41
42 /**
43  * A mutable 2nd class object date.
44  * @author Marina Vatkina
45  * @version 1.0
46  * @see java.util.Vector
47  */

48 public class Vector
49     extends java.util.Vector JavaDoc
50     implements SCOCollection
51 {
52
53     private transient PersistenceCapable owner;
54
55     private transient String JavaDoc fieldName;
56
57     private transient Class JavaDoc elementType;
58  
59     private transient boolean allowNulls;
60
61     private transient java.util.Vector JavaDoc added = new java.util.Vector JavaDoc();
62
63     private transient java.util.Vector JavaDoc removed = new java.util.Vector JavaDoc();
64
65     /**
66      * I18N message handler
67      */

68     private final static ResourceBundle JavaDoc messages = I18NHelper.loadBundle(
69                              "com.sun.jdo.spi.persistence.support.sqlstore.impl.Bundle", // NOI18N
70
Vector.class.getClassLoader());
71
72     private final static ResourceBundle JavaDoc messages1 = I18NHelper.loadBundle(
73                              "com.sun.jdo.spi.persistence.support.sqlstore.Bundle", // NOI18N
74
Vector.class.getClassLoader());
75
76     /**
77      * Constructs an empty vector so that its internal data array
78      * has size <tt>10</tt> and its standard capacity increment is
79      * zero. Assigns owning object and field name
80      * @param owner the owning object
81      * @param fieldName the owning field name
82      * @param elementType the element types allowed
83      * @param allowNulls true if nulls are allowed
84      */

85     public Vector(Object JavaDoc owner, String JavaDoc fieldName, Class JavaDoc elementType, boolean allowNulls)
86     {
87     super();
88     if (owner instanceof PersistenceCapable)
89         {
90                 this.owner = (PersistenceCapable)owner;
91         this.fieldName = fieldName;
92         }
93     this.elementType = elementType;
94     this.allowNulls = allowNulls;
95     }
96
97     /**
98      * Constructs an empty vector with the specified initial capacity and
99      * with its capacity increment equal to zero. Assigns owning object and field name
100      *
101      * @param owner the owning object
102      * @param fieldName the owning field name
103      * @param elementType the element types allowed
104      * @param allowNulls true if nulls are allowed
105      * @param initialCapacity the initial capacity of the vector.
106      * @exception IllegalArgumentException if the specified initial capacity
107      * is negative
108      */

109     public Vector(Object JavaDoc owner, String JavaDoc fieldName,
110             Class JavaDoc elementType, boolean allowNulls, int initialCapacity)
111     {
112     super(initialCapacity);
113     if (owner instanceof PersistenceCapable)
114         {
115                 this.owner = (PersistenceCapable)owner;
116         this.fieldName = fieldName;
117         }
118     this.elementType = elementType;
119     this.allowNulls = allowNulls;
120     }
121
122     /** ------------------Public Methods----------------*/
123
124     /**
125      * Sets the component at the specified <code>index</code> of this
126      * vector to be the specified object. The previous component at that
127      * position is discarded.<p>
128      *
129      * @param obj what the component is to be set to.
130      * @param index the specified index.
131      * @exception ArrayIndexOutOfBoundsException if the index was invalid.
132      * @see java.util.Vector
133      */

134     public synchronized void setElementAt(Object JavaDoc obj, int index) {
135
136     throwUnsupportedOption();
137
138     if (obj == null)
139     {
140         if (allowNulls == false)
141         {
142             throw new JDOUserException(I18NHelper.getMessage(messages,
143                 "sco.nulls_not_allowed")); // NOI18N
144
}
145         // It is actualy remove
146
this.removeElementAt(index);
147     }
148
149     if (elementType == null || elementType.isAssignableFrom(obj.getClass()))
150     {
151         // Mark the field as dirty
152
StateManager stateManager = this.makeDirty();
153
154         Object JavaDoc o = super.elementAt(index);
155         super.setElementAt(obj, index);
156
157         if (added.remove(o) == false)
158             removed.add(o);
159
160         if (removed.remove(obj) == false)
161             added.add(obj);
162
163         // Apply updates
164
this.applyUpdates(stateManager, true);
165
166     } else {
167         throw new JDOUserException(I18NHelper.getMessage(messages,
168                                 "sco.classcastexception", elementType.getName()), // NOI18N
169
new ClassCastException JavaDoc(), new Object JavaDoc[] {obj});
170     }
171
172     }
173
174  
175     /**
176      * Deletes the component at the specified index.
177      *
178      * @param index the index of the object to remove.
179      * @exception ArrayIndexOutOfBoundsException if the index was invalid.
180      * @see java.util.Vector
181      */

182     public synchronized void removeElementAt(int index) {
183
184     throwUnsupportedOption();
185
186     // Mark the field as dirty
187
StateManager stateManager = this.makeDirty();
188
189     Object JavaDoc obj = super.elementAt(index);
190         super.removeElementAt(index);
191     if (added.remove(obj) == false)
192         removed.add(obj);
193
194     // Apply updates
195
this.applyUpdates(stateManager, true);
196
197     }
198
199     /**
200      * Inserts the specified object as a component in this vector at the
201      * specified <code>index</code>.
202      *
203      * @param obj the component to insert.
204      * @param index where to insert the new component.
205      * @exception ArrayIndexOutOfBoundsException if the index was invalid.
206      * @see java.util.Vector
207      */

208     public synchronized void insertElementAt(Object JavaDoc obj, int index) {
209     if (allowNulls == false && obj == null)
210         {
211                 throw new JDOUserException(I18NHelper.getMessage(messages,
212                         "sco.nulls_not_allowed")); // NOI18N
213
}
214
215         if (elementType == null || elementType.isAssignableFrom(obj.getClass()))
216         {
217         // Mark the field as dirty
218
StateManager stateManager = this.makeDirty();
219
220                 super.insertElementAt(obj, index);
221             if (removed.remove(obj) == false)
222             added.add(obj);
223
224         // Apply updates
225
this.applyUpdates(stateManager, true);
226
227     } else {
228         throw new JDOUserException(I18NHelper.getMessage(messages,
229                                 "sco.classcastexception", elementType.getName()), // NOI18N
230
new ClassCastException JavaDoc(), new Object JavaDoc[] {obj});
231     }
232
233     }
234  
235     /**
236      * Adds the specified component to the end of this vector,
237      * increasing its size by one.
238      *
239      * @param obj the component to be added.
240      * @see java.util.Vector
241      */

242     public synchronized void addElement(Object JavaDoc obj) {
243     if (allowNulls == false && obj == null)
244         {
245                 throw new JDOUserException(I18NHelper.getMessage(messages,
246                         "sco.nulls_not_allowed")); // NOI18N
247
}
248
249         if (elementType == null || elementType.isAssignableFrom(obj.getClass()))
250         {
251         // Mark the field as dirty
252
StateManager stateManager = this.makeDirty();
253
254                 super.addElement(obj);
255             if (removed.remove(obj) == false)
256             added.add(obj);
257
258         // Apply updates
259
this.applyUpdates(stateManager, true);
260
261     } else {
262         throw new JDOUserException(I18NHelper.getMessage(messages,
263                                 "sco.classcastexception", elementType.getName()), // NOI18N
264
new ClassCastException JavaDoc(), new Object JavaDoc[] {obj});
265     }
266
267     }
268
269     /**
270      * Removes the first (lowest-indexed) occurrence of the argument
271      * from this vector.
272      *
273      * @param obj the component to be removed.
274      * @return <code>true</code> if the argument was a component of this
275      * vector; <code>false</code> otherwise.
276      * @see java.util.Vector
277      */

278     public synchronized boolean removeElement(Object JavaDoc obj) {
279     
280         // Because java.util.Vector.removeElement(Object) calls internally removeElementAt(int)
281
// which is not supported, we cannot rely on jdk. We need to process remove here.
282

283         // Mark the field as dirty
284
StateManager stateManager = this.makeDirty();
285
286         int i = super.indexOf(obj);
287         if (i > -1) {
288                 super.removeElementAt(i);
289
290                 if (added.remove(obj) == false)
291                         removed.add(obj);
292
293                 // Apply updates
294
this.applyUpdates(stateManager, true);
295                 return true;
296         }
297         return false;
298
299     }
300
301     /**
302      * Removes all components from this vector and sets its size to zero.<p>
303      *
304      * @see java.util.Vector
305      */

306     public synchronized void removeAllElements() {
307     // Mark the field as dirty
308
StateManager stateManager = this.makeDirty();
309
310     for (Iterator JavaDoc iter = super.iterator(); iter.hasNext();) {
311         Object JavaDoc o = iter.next();
312         if (added.remove(o) == false)
313             removed.add(o);
314     }
315     added.clear();
316
317     super.removeAllElements();
318
319     // Apply updates
320
this.applyUpdates(stateManager, true);
321
322     }
323
324
325
326     /**
327      * Replaces the element at the specified position in this Vector with the
328      * specified element.
329      *
330      * @param index index of element to replace.
331      * @param element element to be stored at the specified position.
332      * @return the element previously at the specified position.
333      * @exception ArrayIndexOutOfBoundsException index out of range
334      * (index &lt; 0 || index &gt;= size()).
335      * @exception IllegalArgumentException fromIndex &gt; toIndex.
336      * @see java.util.Vector
337      */

338     public synchronized Object JavaDoc set(int index, Object JavaDoc element) {
339
340     throwUnsupportedOption();
341
342     if (element == null)
343         {
344         if (allowNulls == false)
345                 {
346                         throw new JDOUserException(I18NHelper.getMessage(messages,
347                                 "sco.nulls_not_allowed")); // NOI18N
348
}
349                 // It is actualy remove
350
return this.remove(index);
351         }
352         if (elementType == null || elementType.isAssignableFrom(element.getClass()))
353         {
354         // Mark the field as dirty
355
StateManager stateManager = this.makeDirty();
356
357         Object JavaDoc o = super.set(index, element);
358
359                 if (added.remove(o) == false)
360                         removed.add(o);
361
362                 if (removed.remove(element) == false)
363                         added.add(element);
364
365         // Apply updates
366
this.applyUpdates(stateManager, true);
367
368             return o;
369     } else {
370         throw new JDOUserException(I18NHelper.getMessage(messages,
371                                 "sco.classcastexception", elementType.getName()), // NOI18N
372
new ClassCastException JavaDoc(), new Object JavaDoc[] {element});
373     }
374
375     }
376
377
378     /**
379      * Appends the specified element to the end of this Vector.
380      *
381      * @param o element to be appended to this Vector.
382      * @return true (as per the general contract of Collection.add).
383      * @see java.util.Vector
384      */

385     public synchronized boolean add(Object JavaDoc o) {
386     if (allowNulls == false && o == null)
387         {
388                 throw new JDOUserException(I18NHelper.getMessage(messages,
389                         "sco.nulls_not_allowed")); // NOI18N
390
}
391
392     if (elementType == null || elementType.isAssignableFrom(o.getClass()))
393         {
394         // Mark the field as dirty
395
StateManager stateManager = this.makeDirty();
396
397                 if (removed.remove(o) == false)
398             added.add(o);
399
400             boolean modified = super.add(o);
401
402         // Apply updates
403
this.applyUpdates(stateManager, modified);
404
405             return modified;
406
407     } else {
408                 throw new JDOUserException(I18NHelper.getMessage(messages,
409                                 "sco.classcastexception", elementType.getName()), // NOI18N
410
new ClassCastException JavaDoc(), new Object JavaDoc[] {o});
411     }
412
413     }
414
415     /**
416      * Removes the first occurrence of the specified element in this Vector
417      * If the Vector does not contain the element, it is unchanged.
418      *
419      * @param o element to be removed from this Vector, if present.
420      * @return true if the Vector contained the specified element.
421      * @see java.util.Vector
422      */

423     public boolean remove(Object JavaDoc o) {
424         return this.removeElement(o);
425     }
426
427     /**
428      * Inserts the specified element at the specified position in this Vector.
429      *
430      * @param index index at which the specified element is to be inserted.
431      * @param element element to be inserted.
432      * @exception ArrayIndexOutOfBoundsException index is out of range
433      * (index &lt; 0 || index &gt; size()).
434      * @see java.util.Vector
435      */

436     public void add(int index, Object JavaDoc element) {
437         this.insertElementAt(element, index);
438     }
439
440     /**
441      * Removes the element at the specified position in this Vector.
442      * shifts any subsequent elements to the left (subtracts one from their
443      * indices). Returns the element that was removed from the Vector.
444      *
445      * @param index the index of the element to removed.
446      * @exception ArrayIndexOutOfBoundsException index out of range (index
447      * &lt; 0 || index &gt;= size()).
448      * @see java.util.Vector
449      */

450     public synchronized Object JavaDoc remove(int index) {
451
452     throwUnsupportedOption();
453
454     // Mark the field as dirty
455
StateManager stateManager = this.makeDirty();
456
457         Object JavaDoc obj = super.remove(index);
458
459         if (added.remove(obj) == false)
460         removed.add(obj);
461
462     // Apply updates
463
this.applyUpdates(stateManager, true);
464
465         return obj;
466     }
467
468     /**
469      * Removes all of the elements from this Vector. The Vector will
470      * be empty after this call returns (unless it throws an exception).
471      *
472      * @see java.util.Vector
473      */

474     public void clear() {
475         this.removeAllElements();
476     }
477
478     /**
479      * Appends all of the elements in the specified Collection to the end of
480      * this Vector, in the order that they are returned by the specified
481      * Collection's Iterator.
482      *
483      * @param c elements to be inserted into this Vector.
484      * @see java.util.Vector
485      */

486     public synchronized boolean addAll(Collection JavaDoc c) {
487     if (allowNulls == false && c.contains(null))
488         {
489                 throw new JDOUserException(I18NHelper.getMessage(messages,
490                         "sco.nulls_not_allowed")); // NOI18N
491
}
492
493     java.util.Vector JavaDoc errc = new java.util.Vector JavaDoc();
494     if (elementType != null)
495     {
496         // iterate the collection and make a list of wrong elements.
497
Iterator JavaDoc i = c.iterator();
498         while (i.hasNext())
499         {
500             Object JavaDoc o = i.next();
501             if (!elementType.isAssignableFrom(o.getClass()))
502                 errc.add(o);
503         }
504     }
505     if (errc != null && errc.size() > 0)
506     {
507         throw new JDOUserException(I18NHelper.getMessage(messages,
508                                 "sco.classcastexception", elementType.getName()), // NOI18N
509
new ClassCastException JavaDoc(), errc.toArray());
510     }
511
512     // Mark the field as dirty
513
StateManager stateManager = this.makeDirty();
514
515         removed.removeAll(c);
516     added.addAll(c);
517
518     boolean modified = super.addAll(c);
519
520     // Apply updates
521
this.applyUpdates(stateManager, modified);
522
523     return modified;
524     }
525
526     /**
527      * Removes from this Vector all of its elements that are contained in the
528      * specified Collection.
529      *
530      * @return true if this Vector changed as a result of the call.
531      * @see java.util.Vector
532      */

533     public synchronized boolean removeAll(Collection JavaDoc c) {
534         boolean modified = false;
535     // Mark the field as dirty
536
StateManager stateManager = this.makeDirty();
537
538         Iterator JavaDoc e = c.iterator();
539         while (e.hasNext()) {
540                 Object JavaDoc o = e.next();
541                 if(super.contains(o)) {
542                         removeInternal(o);
543                         if (added.remove(o) == false)
544                                 removed.add(o);
545                         modified = true;
546                 }
547         }
548
549     // Apply updates
550
this.applyUpdates(stateManager, modified);
551
552         return modified;
553     }
554
555     /**
556      * Inserts all of the elements in in the specified Collection into this
557      * Vector at the specified position. Shifts the element currently at
558      * that position (if any) and any subsequent elements to the right
559      * (increases their indices). The new elements will appear in the Vector
560      * in the order that they are returned by the specified Collection's
561      * iterator.
562      *
563      * @param index index at which to insert first element
564      * from the specified collection.
565      * @param c elements to be inserted into this Vector.
566      * @exception ArrayIndexOutOfBoundsException index out of range (index
567      * &lt; 0 || index &gt; size()).
568      * @see java.util.Vector
569      */

570     public synchronized boolean addAll(int index, Collection JavaDoc c) {
571     if (allowNulls == false && c.contains(null))
572         {
573                 throw new JDOUserException(I18NHelper.getMessage(messages,
574                         "sco.nulls_not_allowed")); // NOI18N
575
}
576
577     java.util.Vector JavaDoc errc = new java.util.Vector JavaDoc();
578         if (elementType != null)
579         {
580                 // iterate the collection and make a list of wrong elements.
581
Iterator JavaDoc i = c.iterator();
582                 while (i.hasNext())
583                 {
584                         Object JavaDoc o = i.next();
585                         if (!elementType.isAssignableFrom(o.getClass()))
586                                 errc.add(o);
587                 }
588         }
589         if (errc != null && errc.size() > 0)
590         {
591                 throw new JDOUserException(I18NHelper.getMessage(messages,
592                                 "sco.classcastexception", elementType.getName()), // NOI18N
593
new ClassCastException JavaDoc(), errc.toArray());
594         }
595
596     // Mark the field as dirty
597
StateManager stateManager = this.makeDirty();
598
599         removed.removeAll(c);
600         added.addAll(c);
601
602         boolean modified = super.addAll(index, c);
603
604     // Apply updates
605
this.applyUpdates(stateManager, modified);
606
607         return modified;
608     }
609
610     /**
611      * Retains only the elements in this Vector that are contained in the
612      * specified Collection.
613      *
614      * @return true if this Vector changed as a result of the call.
615      * @see java.util.Vector
616      */

617     public synchronized boolean retainAll(Collection JavaDoc c) {
618     boolean modified = false;
619         java.util.Vector JavaDoc v = new java.util.Vector JavaDoc();
620
621     // Mark the field as dirty
622
StateManager stateManager = this.makeDirty();
623
624         for (Iterator JavaDoc iter = super.iterator(); iter.hasNext();)
625         {
626                 Object JavaDoc o = iter.next();
627                 if (!c.contains(o))
628                 {
629                         v.add(o);
630                         if (added.remove(o) == false)
631                                 removed.add(o);
632
633                         modified = true;
634                 }
635         }
636
637         // Now remove the rest (stored in "v")
638
for (Iterator JavaDoc iter = v.iterator(); iter.hasNext();)
639         {
640                         removeInternal(iter.next());
641         }
642
643     // Apply updates
644
this.applyUpdates(stateManager, modified);
645
646
647         return modified;
648     }
649
650     /**
651      * Creates and returns a copy of this object.
652      *
653      * <P>Mutable Second Class Objects are required to provide a public
654      * clone method in order to allow for copying PersistenceCapable
655      * objects. In contrast to Object.clone(), this method must not throw a
656      * CloneNotSupportedException.
657      */

658     public Object JavaDoc clone()
659     {
660         Vector obj = (Vector)super.clone();
661         obj.unsetOwner();
662
663         return obj;
664     }
665
666     /**
667      * Creates and returns a copy of this object without resetting the owner and field value.
668      *
669      */

670     public Object JavaDoc cloneInternal()
671     {
672         return super.clone();
673     }
674
675     /**
676      * Cleans removed and added lists
677      */

678     public void reset()
679     {
680         added.clear();
681         removed.clear();
682     }
683
684
685     public void markDeferred()
686     {
687     }
688
689     public boolean isDeferred()
690     {
691         return false;
692     }
693
694     public void applyDeferredUpdates(Collection JavaDoc c)
695     {
696         super.addAll(c);
697     }
698
699     /**
700      * Adds an object to the list without recording changes
701      */

702     public void addInternal(Object JavaDoc o)
703     {
704         super.addElement(o);
705     }
706
707  
708     /**
709      * Adds a Collection to the list without recording changes
710      */

711     public void addAllInternal(Collection JavaDoc c)
712     {
713         super.addAll(c);
714     }
715
716     /**
717      * @inheritDoc
718      */

719     public void addToBaseCollection(Object JavaDoc o)
720     {
721         super.add(o);
722     }
723
724     /**
725      * Removes from this collection without recording changes
726      */

727     public void removeAllInternal(Collection JavaDoc c)
728     {
729         super.removeAll(c);
730     }
731
732     /**
733      * Returns added collection
734      *
735      * @return added collection of added elements
736      */

737     public Collection JavaDoc getAdded()
738     {
739         return (Collection JavaDoc)added;
740     }
741
742     /**
743      * Returns removed collection
744      *
745      * @return removed collection of removed elements
746      */

747     public Collection JavaDoc getRemoved()
748     {
749         return (Collection JavaDoc)removed;
750     }
751
752     /**
753      * Clears Collection without notifing the owner
754      */

755     public void clearInternal()
756     {
757     //Cannot call super.clear() as it internally calls removeAllElements()
758
// which causes marking field as dirty.
759

760     int s = super.size() - 1;
761
762     // Need to loop backwards to avoid resetting size of the collection
763
for (int i = s; i > -1; i--)
764     {
765         super.removeElementAt(i);
766     }
767         
768     this.reset();
769     }
770
771
772     /**
773      * Removes an element without notifing the owner
774      */

775     public void removeInternal(Object JavaDoc o)
776     {
777         int i = super.indexOf(o);
778         super.remove(i);
779     }
780
781     /**
782      * Nullifies references to the owner Object and Field
783      */

784     public void unsetOwner()
785     {
786         this.owner = null;
787         this.fieldName = null;
788         this.elementType = null;
789         added.clear();
790         removed.clear();
791     }
792
793     /**
794      * Returns the owner object of the SCO instance
795      *
796      * @return owner object
797      */

798     public Object JavaDoc getOwner()
799     {
800         return this.owner;
801     }
802
803     /**
804      * Returns the field name
805      *
806      * @return field name as java.lang.String
807      */

808     public String JavaDoc getFieldName()
809     {
810         return this.fieldName;
811     }
812  
813     /**
814      * Marks object dirty
815      */

816     public StateManager makeDirty()
817     {
818     if (owner != null)
819     {
820                 StateManager stateManager = owner.jdoGetStateManager();
821                 if (stateManager != null)
822                 {
823                         stateManager.makeDirty(fieldName);
824                 }
825  
826                 return stateManager;
827     }
828     return null;
829      }
830     /**
831      * Apply changes (can be a no-op)
832      */

833     public void applyUpdates(StateManager sm, boolean modified)
834     {
835  
836         if (modified && sm != null)
837         {
838                 sm.applyUpdates(fieldName, this);
839         }
840     }
841
842     /**
843      * Throw JDOUnsupportedOptionException
844      */

845     private void throwUnsupportedOption()
846     {
847         // Index operation that changes the underline collection
848
// is not supported in 2_beta. Bug 4370474
849
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
850                                 "sco.not_supported")); //NOI18N
851
}
852
853     /**
854      * Set the owner if this instance is not owned.
855      * @see SCOCollection#setOwner
856      * @param owner the new owner.
857      * @param fieldName the new field name.
858      * @param elementType the new element type as Class, or null if type
859      * is not to be checked.
860      */

861     public void setOwner(Object JavaDoc owner, String JavaDoc fieldName, Class JavaDoc elementType) {
862
863         if (this.owner != null) {
864             throw new JDOUserException(I18NHelper.getMessage(
865                 messages1, "core.statemanager.anotherowner"), // NOI18N
866
new Object JavaDoc[]{this.owner, this.fieldName});
867         }
868         if (owner instanceof PersistenceCapable) {
869                 this.owner = (PersistenceCapable)owner;
870                 this.fieldName = fieldName;
871                 this.elementType = elementType;
872         }
873     }
874 }
875
Popular Tags