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