1 8 9 package com.sleepycat.bind.tuple; 10 11 24 public class TupleTupleMarshalledKeyCreator extends TupleTupleKeyCreator { 25 26 private String keyName; 27 private TupleTupleMarshalledBinding binding; 28 29 38 public TupleTupleMarshalledKeyCreator(TupleTupleMarshalledBinding binding, 39 String keyName) { 40 41 this.binding = binding; 42 this.keyName = keyName; 43 } 44 45 public boolean createSecondaryKey(TupleInput primaryKeyInput, 47 TupleInput dataInput, 48 TupleOutput indexKeyOutput) { 49 50 54 MarshalledTupleKeyEntity entity = (MarshalledTupleKeyEntity) 55 binding.entryToObject(primaryKeyInput, dataInput); 56 57 return entity.marshalSecondaryKey(keyName, indexKeyOutput); 58 } 59 60 public boolean nullifyForeignKey(TupleInput dataInput, 62 TupleOutput dataOutput) { 63 64 MarshalledTupleKeyEntity entity = (MarshalledTupleKeyEntity) 66 binding.entryToObject(null, dataInput); 67 if (entity.nullifyForeignKey(keyName)) { 68 binding.objectToData(entity, dataOutput); 69 return true; 70 } else { 71 return false; 72 } 73 } 74 } 75 | Popular Tags |