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