• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/db-4.7.25.NC/docs/java/com/sleepycat/persist/evolve/
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.5.0) on Thu May 15 17:17:33 EDT 2008 -->
6<TITLE>
7Conversion (Oracle - Berkeley DB Java API)
8</TITLE>
9
10<META NAME="keywords" CONTENT="com.sleepycat.persist.evolve.Conversion interface">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../style.css" TITLE="Style">
13
14<SCRIPT type="text/javascript">
15function windowTitle()
16{
17    parent.document.title="Conversion (Oracle - Berkeley DB Java API)";
18}
19</SCRIPT>
20<NOSCRIPT>
21</NOSCRIPT>
22
23</HEAD>
24
25<BODY BGCOLOR="white" onload="windowTitle();">
26
27
28<!-- ========= START OF TOP NAVBAR ======= -->
29<A NAME="navbar_top"><!-- --></A>
30<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
31<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
32<TR>
33<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
34<A NAME="navbar_top_firstrow"><!-- --></A>
35<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
36  <TR ALIGN="center" VALIGN="top">
37  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
38  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Conversion.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
45  </TR>
46</TABLE>
47</TD>
48<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
49<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
50</TD>
51</TR>
52
53<TR>
54<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
55&nbsp;PREV CLASS&nbsp;
56&nbsp;<A HREF="../../../../com/sleepycat/persist/evolve/Converter.html" title="class in com.sleepycat.persist.evolve"><B>NEXT CLASS</B></A></FONT></TD>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58  <A HREF="../../../../index.html?com/sleepycat/persist/evolve/Conversion.html" target="_top"><B>FRAMES</B></A>  &nbsp;
59&nbsp;<A HREF="Conversion.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
60&nbsp;<SCRIPT type="text/javascript">
61  <!--
62  if(window==top) {
63    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
64  }
65  //-->
66</SCRIPT>
67<NOSCRIPT>
68  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
69</NOSCRIPT>
70
71
72</FONT></TD>
73</TR>
74<TR>
75<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
76  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
77<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
78DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
79</TR>
80</TABLE>
81<A NAME="skip-navbar_top"></A>
82<!-- ========= END OF TOP NAVBAR ========= -->
83
84<HR>
85<!-- ======== START OF CLASS DATA ======== -->
86<H2>
87<FONT SIZE="-1">
88com.sleepycat.persist.evolve</FONT>
89<BR>
90Interface Conversion</H2>
91<DL>
92<DT><B>All Superinterfaces:</B> <DD><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html" title="class or interface in java.io">Serializable</A></DD>
93</DL>
94<HR>
95<DL>
96<DT><PRE>public interface <B>Conversion</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html" title="class or interface in java.io">Serializable</A></DL>
97</PRE>
98
99<P>
100Converts an old version of an object value to conform to the current class
101 or field definition.
102
103 <p>The <code>Conversion</code> interface is implemented by the user.  A
104 <code>Conversion</code> instance is passed to the <A HREF="../../../../com/sleepycat/persist/evolve/Converter.html#Converter(java.lang.String, int, java.lang.String, com.sleepycat.persist.evolve.Conversion)"><CODE>Converter.Converter(java.lang.String, int, java.lang.String, com.sleepycat.persist.evolve.Conversion)</CODE></A>
105 constructor.</p>
106
107 <p>The <code>Conversion</code> interface extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html" title="class or interface in java.io"><CODE>Serializable</CODE></A> and the
108 <code>Conversion</code> instance is serialized for storage using standard Java
109 serialization.  Normally, the <code>Conversion</code> class should only have
110 transient fields that are initialized in the <A HREF="../../../../com/sleepycat/persist/evolve/Conversion.html#initialize(com.sleepycat.persist.model.EntityModel)"><CODE>initialize(com.sleepycat.persist.model.EntityModel)</CODE></A> method.
111 While non-transient fields are allowed, care must be taken to only include
112 fields that are serializable and will not pull in large amounts of data.</p>
113
114 <p>When a class conversion is specified, two special considerations
115 apply:</p>
116 <ol>
117 <li>A class conversion is only applied when to instances of that class.  The
118 conversion will not be applied when the class when it appears as a
119 superclass of the instance's class.  In this case, a conversion for the
120 instance's class must also be specified.</li>
121 <li>Although field renaming (as well as all other changes) is handled by the
122 conversion method, a field Renamer is still needed when a secondary key
123 field is renamed and field Deleter is still needed when a secondary key
124 field is deleted.  This is necessary for evolution of the metadata;
125 specifically, if the key name changes the database must be renamed and if
126 the key field is deleted the secondary database must be deleted.</li>
127 </ol>
128
129 <p>The <code>Conversion</code> class must implement the standard equals method.
130 See <A HREF="../../../../com/sleepycat/persist/evolve/Conversion.html#equals(java.lang.Object)"><CODE>equals(java.lang.Object)</CODE></A> for more information.</p>
131
132 <p>Conversions of simple types are generally simple.  For example, a <code>String</code> field that contains only integer values can be easily converted to
133 an <code>int</code> field:</p>
134 <pre class="code">
135  // The old class.  Version 0 is implied.
136  //
137  @Persistent
138  class Address {
139      String zipCode;
140      ...
141  }
142
143  // The new class.  A new version number must be assigned.
144  //
145  @Persistent(version=1)
146  class Address {
147      int zipCode;
148      ...
149  }
150
151  // The conversion class.
152  //
153  class MyConversion1 implements Conversion {
154
155      public void initialize(EntityModel model) {
156          // No initialization needed.
157      }
158
159      public Object convert(Object fromValue) {
160          return Integer.valueOf((String) fromValue);
161      }
162
163      <code>@Override</code>
164      public boolean equals(Object o) {
165          return o instanceof MyConversion1;
166      }
167  }
168
169  // Create a field converter mutation.
170  //
171  Converter converter = new Converter(Address.class.getName(), 0,
172                                      "zipCode", new MyConversion1());
173
174  // Configure the converter as described <A HREF="../../../../com/sleepycat/persist/evolve/Mutations.html" title="class in com.sleepycat.persist.evolve"><CODE>here</CODE></A>.</pre>
175
176 <p>A conversion may perform arbitrary transformations on an object.  For
177 example, a conversion may transform a single String address field into an
178 Address object containing four fields for street, city, state and zip
179 code.</p>
180 <pre class="code">
181  // The old class.  Version 0 is implied.
182  //
183  @Entity
184  class Person {
185      String address;
186      ...
187  }
188
189  // The new class.  A new version number must be assigned.
190  //
191  @Entity(version=1)
192  class Person {
193      Address address;
194      ...
195  }
196
197  // The new address class.
198  //
199  @Persistent
200  class Address {
201      String street;
202      String city;
203      String state;
204      int zipCode;
205      ...
206  }
207
208  class MyConversion2 implements Conversion {
209      private transient RawType addressType;
210
211      public void initialize(EntityModel model) {
212          addressType = model.getRawType(Address.class.getName());
213      }
214
215      public Object convert(Object fromValue) {
216
217          // Parse the old address and populate the new address fields
218          //
219          String oldAddress = (String) fromValue;
220          Map&lt;String,Object&gt; addressValues = new HashMap&lt;String,Object&gt;();
221          addressValues.put("street", parseStreet(oldAddress));
222          addressValues.put("city", parseCity(oldAddress));
223          addressValues.put("state", parseState(oldAddress));
224          addressValues.put("zipCode", parseZipCode(oldAddress));
225
226          // Return new raw Address object
227          //
228          return new RawObject(addressType, addressValues, null);
229      }
230
231      <code>@Override</code>
232      public boolean equals(Object o) {
233          return o instanceof MyConversion2;
234      }
235
236      private String parseStreet(String oldAddress) { ... }
237      private String parseCity(String oldAddress) { ... }
238      private String parseState(String oldAddress) { ... }
239      private Integer parseZipCode(String oldAddress) { ... }
240  }
241
242  // Create a field converter mutation.
243  //
244  Converter converter = new Converter(Person.class.getName(), 0,
245                                      "address", new MyConversion2());
246
247  // Configure the converter as described <A HREF="../../../../com/sleepycat/persist/evolve/Mutations.html" title="class in com.sleepycat.persist.evolve"><CODE>here</CODE></A>.</pre>
248
249 <p>Note that when a conversion returns a <A HREF="../../../../com/sleepycat/persist/raw/RawObject.html" title="class in com.sleepycat.persist.raw"><CODE>RawObject</CODE></A>, it must return
250 it with a <A HREF="../../../../com/sleepycat/persist/raw/RawType.html" title="interface in com.sleepycat.persist.raw"><CODE>RawType</CODE></A> that is current as defined by the current class
251 definitions.  The proper types can be obtained from the <A HREF="../../../../com/sleepycat/persist/model/EntityModel.html" title="class in com.sleepycat.persist.model"><CODE>EntityModel</CODE></A>
252 in the conversion's <A HREF="../../../../com/sleepycat/persist/evolve/Conversion.html#initialize(com.sleepycat.persist.model.EntityModel)"><CODE>initialize</CODE></A> method.</p>
253
254 <p>A variation on the example above is where several fields in a class
255 (street, city, state and zipCode) are converted to a single field (address).
256 In this case a class converter rather than a field converter is used.</p>
257
258 <pre class="code">
259  // The old class.  Version 0 is implied.
260  //
261  @Entity
262  class Person {
263      String street;
264      String city;
265      String state;
266      int zipCode;
267      ...
268  }
269
270  // The new class.  A new version number must be assigned.
271  //
272  @Entity(version=1)
273  class Person {
274      Address address;
275      ...
276  }
277
278  // The new address class.
279  //
280  @Persistent
281  class Address {
282      String street;
283      String city;
284      String state;
285      int zipCode;
286      ...
287  }
288
289  class MyConversion3 implements Conversion {
290      private transient RawType newPersonType;
291      private transient RawType addressType;
292
293      public void initialize(EntityModel model) {
294          newPersonType = model.getRawType(Person.class.getName());
295          addressType = model.getRawType(Address.class.getName());
296      }
297
298      public Object convert(Object fromValue) {
299
300          // Get field value maps for old and new objects.
301          //
302          RawObject person = (RawObject) fromValue;
303          Map&lt;String,Object&gt; personValues = person.getValues();
304          Map&lt;String,Object&gt; addressValues = new HashMap&lt;String,Object&gt;();
305          RawObject address = new RawObject(addressType, addressValues, null);
306
307          // Remove the old address fields and insert the new one.
308          //
309          addressValues.put("street", personValues.remove("street"));
310          addressValues.put("city", personValues.remove("city"));
311          addressValues.put("state", personValues.remove("state"));
312          addressValues.put("zipCode", personValues.remove("zipCode"));
313          personValues.put("address", address);
314
315          return new RawObject(newPersonType, personValues, person.getSuper());
316      }
317
318      <code>@Override</code>
319      public boolean equals(Object o) {
320          return o instanceof MyConversion3;
321      }
322  }
323
324  // Create a class converter mutation.
325  //
326  Converter converter = new Converter(Person.class.getName(), 0,
327                                      new MyConversion3());
328
329  // Configure the converter as described <A HREF="../../../../com/sleepycat/persist/evolve/Mutations.html" title="class in com.sleepycat.persist.evolve"><CODE>here</CODE></A>.</pre>
330
331
332 <p>A conversion can also handle changes to class hierarchies.  For example,
333 if a "name" field originally declared in class A is moved to its superclass
334 B, a conversion can move the field value accordingly:</p>
335
336 <pre class="code">
337  // The old classes.  Version 0 is implied.
338  //
339  @Persistent
340  class A extends B {
341      String name;
342      ...
343  }
344  @Persistent
345  abstract class B {
346      ...
347  }
348
349  // The new classes.  A new version number must be assigned.
350  //
351  @Persistent(version=1)
352  class A extends B {
353      ...
354  }
355  @Persistent(version=1)
356  abstract class B {
357      String name;
358      ...
359  }
360
361  class MyConversion4 implements Conversion {
362      private transient RawType newAType;
363      private transient RawType newBType;
364
365      public void initialize(EntityModel model) {
366          newAType = model.getRawType(A.class.getName());
367          newBType = model.getRawType(B.class.getName());
368      }
369
370      public Object convert(Object fromValue) {
371          RawObject oldA = (RawObject) fromValue;
372          RawObject oldB = oldA.getSuper();
373          Map&lt;String,Object&gt; aValues = oldA.getValues();
374          Map&lt;String,Object&gt; bValues = oldB.getValues();
375          bValues.put("name", aValues.remove("name"));
376          RawObject newB = new RawObject(newBType, bValues, oldB.getSuper());
377          RawObject newA = new RawObject(newAType, aValues, newB);
378          return newA;
379      }
380
381      <code>@Override</code>
382      public boolean equals(Object o) {
383          return o instanceof MyConversion4;
384      }
385  }
386
387  // Create a class converter mutation.
388  //
389  Converter converter = new Converter(A.class.getName(), 0,
390                                      new MyConversion4());
391
392  // Configure the converter as described <A HREF="../../../../com/sleepycat/persist/evolve/Mutations.html" title="class in com.sleepycat.persist.evolve"><CODE>here</CODE></A>.</pre>
393
394 <p>A conversion may return an instance of a different class entirely, as
395 long as it conforms to current class definitions and is the type expected
396 in the given context (a subtype of the old type, or a type compatible with
397 the new field type).  For example, a field that is used to discriminate
398 between two types of objects could be removed and replaced by two new
399 subclasses:</p> <pre class="code">
400  // The old class.  Version 0 is implied.
401  //
402  @Persistent
403  class Pet {
404      boolean isCatNotDog;
405      ...
406  }
407
408  // The new classes.  A new version number must be assigned to the Pet class.
409  //
410  @Persistent(version=1)
411  class Pet {
412      ...
413  }
414  @Persistent
415  class Cat extends Pet {
416      ...
417  }
418  @Persistent
419  class Dog extends Pet {
420      ...
421  }
422
423  class MyConversion5 implements Conversion {
424      private transient RawType newPetType;
425      private transient RawType dogType;
426      private transient RawType catType;
427
428      public void initialize(EntityModel model) {
429          newPetType = model.getRawType(Pet.class.getName());
430          dogType = model.getRawType(Dog.class.getName());
431          catType = model.getRawType(Cat.class.getName());
432      }
433
434      public Object convert(Object fromValue) {
435          RawObject pet = (RawObject) fromValue;
436          Map&lt;String,Object&gt; petValues = pet.getValues();
437          Boolean isCat = (Boolean) petValues.remove("isCatNotDog");
438          RawObject newPet = new RawObject(newPetType, petValues,
439                                           pet.getSuper());
440          RawType newSubType = isCat ? catType : dogType;
441          return new RawObject(newSubType, Collections.emptyMap(), newPet);
442      }
443
444      <code>@Override</code>
445      public boolean equals(Object o) {
446          return o instanceof MyConversion5;
447      }
448  }
449
450  // Create a class converter mutation.
451  //
452  Converter converter = new Converter(Pet.class.getName(), 0,
453                                      new MyConversion5());
454
455  // Configure the converter as described <A HREF="../../../../com/sleepycat/persist/evolve/Mutations.html" title="class in com.sleepycat.persist.evolve"><CODE>here</CODE></A>.</pre>
456
457 <p>The primary limitation of a conversion is that it may access at most a
458 single entity instance at one time.  Conversions involving multiple entities
459 at once may be made by performing a <a
460 href="package-summary.html#storeConversion">store conversion</a>.</p>
461<P>
462
463<P>
464<DL>
465<DT><B>See Also:</B><DD><A HREF="../../../../com/sleepycat/persist/evolve/package-summary.html"><CODE>Class Evolution</CODE></A></DL>
466<HR>
467
468<P>
469
470<!-- ========== METHOD SUMMARY =========== -->
471
472<A NAME="method_summary"><!-- --></A>
473<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
474<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
475<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
476<B>Method Summary</B></FONT></TH>
477</TR>
478<TR BGCOLOR="white" CLASS="TableRowColor">
479<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
480<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
481<TD><CODE><B><A HREF="../../../../com/sleepycat/persist/evolve/Conversion.html#convert(java.lang.Object)">convert</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;fromValue)</CODE>
482
483<BR>
484&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts an old version of an object value to conform to the current
485 class or field definition.</TD>
486</TR>
487<TR BGCOLOR="white" CLASS="TableRowColor">
488<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
489<CODE>&nbsp;boolean</CODE></FONT></TD>
490<TD><CODE><B><A HREF="../../../../com/sleepycat/persist/evolve/Conversion.html#equals(java.lang.Object)">equals</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;other)</CODE>
491
492<BR>
493&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The standard <code>equals</code> method that must be implemented by
494 conversion class.</TD>
495</TR>
496<TR BGCOLOR="white" CLASS="TableRowColor">
497<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
498<CODE>&nbsp;void</CODE></FONT></TD>
499<TD><CODE><B><A HREF="../../../../com/sleepycat/persist/evolve/Conversion.html#initialize(com.sleepycat.persist.model.EntityModel)">initialize</A></B>(<A HREF="../../../../com/sleepycat/persist/model/EntityModel.html" title="class in com.sleepycat.persist.model">EntityModel</A>&nbsp;model)</CODE>
500
501<BR>
502&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Initializes the conversion, allowing it to obtain raw type information
503 from the entity model.</TD>
504</TR>
505</TABLE>
506&nbsp;
507<P>
508
509<!-- ============ METHOD DETAIL ========== -->
510
511<A NAME="method_detail"><!-- --></A>
512<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
513<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
514<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
515<B>Method Detail</B></FONT></TH>
516</TR>
517</TABLE>
518
519<A NAME="initialize(com.sleepycat.persist.model.EntityModel)"><!-- --></A><H3>
520initialize</H3>
521<PRE>
522void <B>initialize</B>(<A HREF="../../../../com/sleepycat/persist/model/EntityModel.html" title="class in com.sleepycat.persist.model">EntityModel</A>&nbsp;model)</PRE>
523<DL>
524<DD>Initializes the conversion, allowing it to obtain raw type information
525 from the entity model.
526<P>
527<DD><DL>
528</DL>
529</DD>
530<DD><DL>
531</DL>
532</DD>
533</DL>
534<HR>
535
536<A NAME="convert(java.lang.Object)"><!-- --></A><H3>
537convert</H3>
538<PRE>
539<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>convert</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;fromValue)</PRE>
540<DL>
541<DD>Converts an old version of an object value to conform to the current
542 class or field definition.
543
544 <p>If a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/RuntimeException.html" title="class or interface in java.lang"><CODE>RuntimeException</CODE></A> is thrown by this method, it will be
545 thrown to the original caller.  Similarly, a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang"><CODE>IllegalArgumentException</CODE></A> will be thrown to the original caller if the
546 object returned by this method does not conform to current class
547 definitions.</p>
548
549 <p>The class of the input and output object may be one of the simple
550 types or <A HREF="../../../../com/sleepycat/persist/raw/RawObject.html" title="class in com.sleepycat.persist.raw"><CODE>RawObject</CODE></A>.  For primitive types, the primitive wrapper
551 class is used.</p>
552<P>
553<DD><DL>
554</DL>
555</DD>
556<DD><DL>
557<DT><B>Parameters:</B><DD><CODE>fromValue</CODE> - the object value being converted.  The type of this
558 value is defined by the old class version that is being converted.
559<DT><B>Returns:</B><DD>the converted object.  The type of this value must conform to
560 a current class definition.  If this is a class conversion, it must
561 be the current version of the class.  If this is a field conversion, it
562 must be of a type compatible with the current declared type of the
563 field.</DL>
564</DD>
565</DL>
566<HR>
567
568<A NAME="equals(java.lang.Object)"><!-- --></A><H3>
569equals</H3>
570<PRE>
571boolean <B>equals</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;other)</PRE>
572<DL>
573<DD>The standard <code>equals</code> method that must be implemented by
574 conversion class.
575
576 <p>When mutations are specified when opening a store, the specified and
577 previously stored mutations are compared for equality.  If they are
578 equal, there is no need to replace the existing mutations in the stored
579 catalog.  To accurately determine equality, the conversion class must
580 implement the <code>equals</code> method.</p>
581
582 <p>If the <code>equals</code> method is not explicitly implemented by the
583 conversion class or a superclass other than <code>Object</code>, <code>IllegalArgumentException</code> will be thrown when the store is opened.</p>
584
585 <p>Normally whenever <code>equals</code> is implemented the <code>hashCode</code>
586 method should also be implemented to support hash sets and maps.
587 However, hash sets and maps containing <code>Conversion</code> objects
588 are not used by the DPL and therefore the DPL does not require
589 <code>hashCode</code> to be implemented.</p>
590<P>
591<DD><DL>
592<DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></DL>
593</DD>
594<DD><DL>
595</DL>
596</DD>
597</DL>
598<!-- ========= END OF CLASS DATA ========= -->
599<HR>
600
601
602<!-- ======= START OF BOTTOM NAVBAR ====== -->
603<A NAME="navbar_bottom"><!-- --></A>
604<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
605<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
606<TR>
607<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
608<A NAME="navbar_bottom_firstrow"><!-- --></A>
609<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
610  <TR ALIGN="center" VALIGN="top">
611  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
612  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
613  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
614  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Conversion.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
615  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
616  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
617  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
618  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
619  </TR>
620</TABLE>
621</TD>
622<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
623<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
624</TD>
625</TR>
626
627<TR>
628<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
629&nbsp;PREV CLASS&nbsp;
630&nbsp;<A HREF="../../../../com/sleepycat/persist/evolve/Converter.html" title="class in com.sleepycat.persist.evolve"><B>NEXT CLASS</B></A></FONT></TD>
631<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
632  <A HREF="../../../../index.html?com/sleepycat/persist/evolve/Conversion.html" target="_top"><B>FRAMES</B></A>  &nbsp;
633&nbsp;<A HREF="Conversion.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
634&nbsp;<SCRIPT type="text/javascript">
635  <!--
636  if(window==top) {
637    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
638  }
639  //-->
640</SCRIPT>
641<NOSCRIPT>
642  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
643</NOSCRIPT>
644
645
646</FONT></TD>
647</TR>
648<TR>
649<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
650  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
651<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
652DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
653</TR>
654</TABLE>
655<A NAME="skip-navbar_bottom"></A>
656<!-- ======== END OF BOTTOM NAVBAR ======= -->
657
658<HR>
659<font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
660</BODY>
661</HTML>
662