1 16 17 package javax.jdo.spi; 18 19 import javax.jdo.PersistenceManager; 20 import javax.jdo.JDOHelper; 22 26 27 54 public interface PersistenceCapable { 55 58 static final byte READ_WRITE_OK = 0; 59 60 63 static final byte LOAD_REQUIRED = 1; 64 65 70 static final byte DETACHED = 2; 71 72 75 static final byte READ_OK = -1; 76 77 81 static final byte CHECK_READ = 1; 82 83 87 static final byte MEDIATE_READ = 2; 88 89 94 static final byte CHECK_WRITE = 4; 95 96 100 static final byte MEDIATE_WRITE = 8; 101 102 105 static final byte SERIALIZABLE = 16; 106 107 115 PersistenceManager jdoGetPersistenceManager(); 116 117 133 void jdoReplaceStateManager(StateManager sm) 134 throws SecurityException ; 135 136 142 void jdoProvideField(int fieldNumber); 143 144 150 void jdoProvideFields(int[] fieldNumbers); 151 152 158 void jdoReplaceField(int fieldNumber); 159 160 166 void jdoReplaceFields(int[] fieldNumbers); 167 168 172 void jdoReplaceFlags(); 173 174 181 void jdoCopyFields(Object other, int[] fieldNumbers); 182 183 201 void jdoMakeDirty(String fieldName); 202 203 229 Object jdoGetObjectId(); 230 231 242 Object jdoGetTransactionalObjectId(); 243 244 248 Object jdoGetVersion(); 249 250 262 boolean jdoIsDirty(); 263 264 275 boolean jdoIsTransactional(); 276 277 284 boolean jdoIsPersistent(); 285 286 298 boolean jdoIsNew(); 299 300 311 boolean jdoIsDeleted(); 312 313 323 boolean jdoIsDetached(); 324 325 334 PersistenceCapable jdoNewInstance(StateManager sm); 335 336 348 PersistenceCapable jdoNewInstance(StateManager sm, Object oid); 349 350 354 Object jdoNewObjectIdInstance(); 355 356 366 Object jdoNewObjectIdInstance(Object o); 367 368 371 void jdoCopyKeyFieldsToObjectId(Object oid); 372 373 390 void jdoCopyKeyFieldsToObjectId(ObjectIdFieldSupplier fm, Object oid); 391 392 409 void jdoCopyKeyFieldsFromObjectId(ObjectIdFieldConsumer fm, Object oid); 410 411 414 static interface ObjectIdFieldManager extends ObjectIdFieldConsumer, ObjectIdFieldSupplier {} 415 416 421 static interface ObjectIdFieldSupplier { 422 423 428 boolean fetchBooleanField(int fieldNumber); 429 430 435 char fetchCharField(int fieldNumber); 436 437 442 byte fetchByteField(int fieldNumber); 443 444 449 short fetchShortField(int fieldNumber); 450 451 456 int fetchIntField(int fieldNumber); 457 458 463 long fetchLongField(int fieldNumber); 464 465 470 float fetchFloatField(int fieldNumber); 471 472 477 double fetchDoubleField(int fieldNumber); 478 479 484 String fetchStringField(int fieldNumber); 485 486 491 Object fetchObjectField(int fieldNumber); 492 } 493 494 499 static interface ObjectIdFieldConsumer { 500 501 506 void storeBooleanField(int fieldNumber, boolean value); 507 508 513 void storeCharField(int fieldNumber, char value); 514 515 520 void storeByteField(int fieldNumber, byte value); 521 522 527 void storeShortField(int fieldNumber, short value); 528 529 534 void storeIntField(int fieldNumber, int value); 535 536 541 void storeLongField(int fieldNumber, long value); 542 543 548 void storeFloatField(int fieldNumber, float value); 549 550 555 void storeDoubleField(int fieldNumber, double value); 556 557 562 void storeStringField(int fieldNumber, String value); 563 564 569 void storeObjectField(int fieldNumber, Object value); 570 } 571 } 572 | Popular Tags |